freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

[工學(xué)]anintroductiontojavaapplication-閱讀頁(yè)

2025-02-05 13:03本頁(yè)面
  

【正文】 300=23 To solve task3 ? 3 steps ? Enter two numbers ? Compare the relation between two numbers ? = = == ! = ? Output the relation of two numbers New things1 ? Compare two numbers ? Equality and relational operators ? = = == != ? The result can be either true or false ?Example ? 57 : false ? 5=7 : true ? 5== 7 : false New thing2:if ? If statement ? pare two number if true output the relation else output nothing ? If(condition) statement。 / / p r o g r a m u s e s c l a s s S c a n n e r 5 6 p u b l i c c l a s s C o m p a r i s o n 7 { 8 / / m a i n m e t h o d b e g i n s e x e c u t i o n o f J a v a a p p l i c a t i o n 9 p u b l i c s t a t i c v o i d m a i n ( S t r i n g a r g s [ ] ) 10 { 11 / / c r e a t e S c a n n e r t o o b t a i n i n p u t f r o m c o m m a n d w i n d o w 12 S c a n n e r i n p u t = n e w S c a n n e r ( S y s t e m . i n ) 。 / / f i r s t n u m b e r t o c o m p a r e 15 int n u m b e r 2 。 / / p r o m p t 18 n u m b e r 1 = i n p u t . n e x t I n t ( ) 。 / / p r o m p t 21 n u m b e r 2 = i n p u t . n e x t I n t ( ) 。 25 26 if ( n u m b e r 1 ! = n u m b e r 2 ) 27 S y s t e m . o u t . p r i n t f ( % d ! = % d \ n , n u m b e r 1 , n u m b e r 2 ) 。 Test for equality, display result using printf. Compares two numbers using relational operator . Outline ? ?(2 of 2) ?Program output 31 32 if ( n u m b e r 1 n u m b e r 2 ) 33 S y s t e m . o u t . p r i n t f ( % d % d \ n , n u m b e r 1 , n u m b e r 2 ) 。 37 38 if ( n u m b e r 1 = n u m b e r 2 ) 39 S y s t e m . o u t . p r i n t f ( % d = % d \ n , n u m b e r 1 , n u m b e r 2 ) 。 number1= ()。 int number1,number2。 number2= ()。 777!=777 (“%d!=%d”,number1,number2)。 777777 (“%d%d”,number1,number2)。 777=777 (“%d=%d”,number1,number2)。 ? the result of Condition will be true or false ? If (true) statement will be executed ? If(false) statement will skip. ? don’t fet the left and right () Your job ? Finish this program ? Page 68 ?Page 69 Page 68 ? Key statements if(number1number2) (“%d is larger”,number1)。 if(number1==number2) (“These number are equals”)。 If(remainder == 0) (“%d is the multiple of %d”,number1,number2)。 Decision Making: Equality and Relational Operators ? Condition ? Expression can be either true or false ?if statement ? Simple version in this section, more detail later ? If a condition is true, then the body of the if statement executed ? Control always resumes after the if statement ? Conditions in if statements can be formed using equality or relational operators (next slide) Fig. | Equality and relational operators. Stand ard al geb r aic equ ali t y or rel at ion al op era to r Ja v a eq ualit y or rela ti on al op era to r Sample Ja v a con dit io n Meanin g o f Ja v a co nd i tio n E q u a l i t y o p e r a t o r s ? ? == x = = y x is eq u a l t o y ? ? != x ! = y x is n o t e q u a l t o y R el a t i o n a l o p e r a t o r s ? ? x y x is gr eat er t h a n y ? ? x y x is le s s t h an y ? ? = x = y x is gr eat er t h a n or e q u al t o y ≤ ?? = x = y x is le s s t h an o r e q u al to y Outline ? Comparison.java ? (1 of 2) ? 1. Class Comparison main Declarations Input data (nextInt) Compare two inputs using if statements 1 / / F i g . 2 . 1 5 : C o m p a r i s o n . j a v a 2 / / C o m p a r e i n t e g e r s u s i n g i f s t a t e m e n t s , r e l a t i o n a l o p e r a t o r s 3 / / a n d e q u a l i t y o p e r a t o r s . 4 i m p o r t j a v a . u t i l . S c a n n e r 。 13 14 int n u m b e r 1 。 / / s e c o n d n u m b e r t o c o m p a r e 16 17 S y s t e m . o u t . p r i n t ( E n t e r f i r s t i n t e g e r : ) 。 / / r e a d f i r s t n u m b e r f r o m u s e r 19 20 S y s t e m . o u t . p r i n t ( E n t e r s e c o n d i n t e g e r : ) 。 / / r e a d s e c o n d n u m b e r f r o m u s e r 22 23 if ( n u m b e r 1 = = n u m b e r 2 ) 24 S y s t e m . o u t . p r i n t f ( % d = = % d \ n , n u m b e r 1 , n u m b e r 2 ) 。 28 29 if ( n u m b e r 1 n u m b e r 2 ) 30 S y s t e m . o u t . p r i n t f ( % d % d \ n , n u m b e r 1 , n u m b e r 2 ) 。 34 35 if ( n u m b e r 1 = n u m b e r 2 ) 36 S y s t e m . o u t . p r i n t f ( % d = % d \ n , n u m b e r 1 , n u m b e r 2 ) 。 40 41 } / / e n d m e t h o d m a i n 42 43 } / / e n d c l a s s C o m p a r i s o n E n t e r f i r s t i n t e g e r : 7 7 7 E n t e r s e c o n d i n t e g e r : 7 7 7 7 7 7 = = 7 7 7 7 7 7 = 7 7 7 7 7 7 = 7 7 7 E n t e r f i r s t i n t e g e r : 1 0 0 0 E n t e r s e c o n d i n t e g e r : 2 0 0 0 1 0 0 0 ! = 2 0 0 0 1 0 0 0 2 0 0 0 1 0 0 0 = 2 0 0 0 E n t e r f i r s t i n t e g e r : 2 0 0 0 E n t e r s e c o n d i n t e g e r : 1 0 0 0 2 0 0 0 ! = 1 0 0 0 2 0 0 0 1 0 0 0 2 0 0 0 = 1 0 0 0 Compares two numbers using relational operator , = and =. Decision Making: Eq
點(diǎn)擊復(fù)制文檔內(nèi)容
教學(xué)課件相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1