Java±à³Ì»ù´¡ÖªÊ¶µã»ã×ÜÏ°Ì⼯--´ð°¸

42. ÏÖÓдúÂëƬ¶Î£º

String s=\£» String sl=S+456;

ÇëÎÊslµÄ½á¹ûÊÇÄÄÏ( A )

A. 123456 B. 579 C£®±àÒë´íÎó D£®ÔËÐÐʱÅ׳öÒì³£ 43. »ù±¾Êý¾ÝÀàÐÍfloatµÄ°ü¹üÀàÊÇÄÄÏ( C )

A£® Integer B£® Double C£® Float D£® Character 44. ÏÖÓУº

1£® class Test4 {

2. public static void main (String [] args) { 3£® boolean X=true; 4£® boolean y=false; 5£® short Z=42;

6. if((z++==42) £¦£¦ (y=true))z++; 7. if((x=false) || (++z==45)) z++; 8. System. out.println(¡§z=¡±+z); 9. } 10. }

½á¹ûΪ( D )

A. Z=42 B. z=44 C£® Z= 45 D£® z= 46 Èý¡¢ Ð޸ijÌÐò´íÎó

1. public class Test{

public static void main(String args[]){ int i;

int k=100.0; // k=100; int j =i+1; } }

2. public class Test{

public void main(String args[]){

float f=12.5; //double f=12.5; int k=f; //double k=f; int j =f+1; //double j =f+1; } }

3. public class Test{

public void main(String args[]){ byte i=128; //int i=128; long k=i*3+4; double d =k*3.1; } }

4. public class Test{

public void main(String args[]){ double d=1234.5;

long k=long(d); // long k=(long)d; long i =k+3.5; //double i =k+3.5; } }

5. public class Test{

public void main(String args[]){

char c=¡±a¡±; // String c=¡±a¡±; String s=¡±1234¡±; c=a; //c=s;

×ÊÁÏ

}

}

ËÄ¡¢ ·ÖÎö³ÌÐò£¬Ð´³öÔËÐнá¹û

1. public class Test{

public void main(String args[]){ byte b=3; b=b+4;

System.out.println(¡°b=¡±+b); }

} //b=7 2. public class Test{

public void main(String args[]){ int x=12; {

int y=96;

System.out.println(¡°x is¡±+x);

System.out.println(¡°y is¡±+y);

} y=x;

System.out.println(¡°x is¡±+x); }

} //±àÒë³ö´í Îå¡¢ ±à³ÌÌâ

1¡¢ °´ÕÕÒÔÏÂÒªÇ󣬱àдJava´úÂ룺

£¨1£© ÉùÃ÷Ò»¸öÃûΪmillesµÄdoubleÐͱäÁ¿£¬³õֵΪ100£»

£¨2£© ÉùÃ÷Ò»¸öÃûΪMILE_TO_KILOMETERµÄdoubleÐͳ£Á¿£¬ÆäֵΪ1.609 £¨3£© ÉùÃ÷Ò»¸öÃûΪkilometerµÄdoubleÐͱäÁ¿£¬²¢¸³ÖµÎª11.5£¬½«milesºÍMILE_TO_KILOMETER

Ïà³Ë£¬²¢½«½á¹û¸³Öµ¸økilometer£»

£¨4£© ÔÚ¿ØÖÆ̨ÉÏÏÔʾkilometer£¬ÏÖÔÚkilometerµÄÖµÊǶàÉÙ£¿

class HelloWord{ }

public static void main(String args[]){ }

double milles=100;

final double MILE_TO_KILOMETER=1.609; double kilometer=11.5;

kilometer=milles*MILE_TO_KILOMETER;

System.out.print(\ÏÖÔÚkilometerµÄÖµÊÇ\+kilometer);

2¡¢ °´ÕÕÒÔÏÂÒªÇ󣬱àдJava´úÂ룺

£¨1£© Ïȶ¨Òå3¸ö±äÁ¿£¬·Ö±ðΪԲÖùÌåµ×Ãæ°ë¾¶¡¢¸ßºÍÌå»ý£» £¨2£© ÊäÈë°ë¾¶ºÍ¸ß£» £¨3£© ¼ÆËãÔ²ÖùÌåÌå»ý£» £¨4£© Êä³ö¼ÆËã½á¹û¡£

import java.util.Scanner;

class HelloWord{

public static void main(String args[]){

×ÊÁÏ

} }

double v,r,h;

final double PI=3.14;

Scanner scan=new Scanner(System.in); System.out.println(\ÇëÊäÈë°ë¾¶£º\); r=scan.nextDouble();

System.out.println(\ÇëÊäÈë¸ß£º\); h=scan.nextDouble(); v=PI*r*r*h;

System.out.println(\Ìå»ýΪ£º\+v);

3¡¢ ±àд³ÌÐò½«°õת»»ÎªÇ§¿Ë¡£³ÌÐòÌáʾÓû§ÊäÈë°õÊý£¬×ª»»ÎªÇ§¿Ë²¢ÏÔʾ½á¹û¡£Ò»°õÔ¼µÈÓÚ0.454

ǧ¿Ë¡£

import java.util.Scanner; class HelloWord{ }

public static void main(String args[]){ }

double x,y;

Scanner scan=new Scanner(System.in); System.out.println(\ÇëÊäÈë°õÊý£º\); x=scan.nextDouble(); y=0.454*x;

System.out.println(x+\°õ=\+y+\ǧ¿Ë\);

4¡¢ ±àдһ¸ö³ÌÐò£¬¶ÁÈë·ÑÓÃÓëÌá³ÉÂÊ£¬¼ÆËãÌá³ÉÓë×Ü·ÑÓá£ÀýÈ磬Èç¹ûÊäÈë10×÷Ϊ·ÑÓã¬12%×÷

ΪÌá³ÉÂÊ£¬ÔòÏÔʾÌá³É·ÑΪ1.2£¬×Ü·ÑÓÃΪ11.2¡£

import java.util.Scanner; class HelloWord{

public static void main(String args[]){ } }

double x,y,s;

Scanner scan=new Scanner(System.in); System.out.println(\ÇëÊäÈë·ÑÓãº\); x=scan.nextDouble(); y=x*0.12; s=x+y;

System.out.println(\×Ü·ÑÓÃ=\+s);

5¡¢ ±àд³ÌÐò¶ÁÈë0µ½1000Ö®¼äµÄÒ»¸öÕûÊý£¬²¢½«Æä¸÷¸öλÉϵÄÊý×Ö¼ÓÆðÀ´¡£ÀýÈ磬ÕûÊý832£¬¸÷

λÊý×ÖÖ®ºÍΪ13¡£

import java.util.Scanner; class HelloWord{

×ÊÁÏ

public static void main(String args[]){ int x,y;

Scanner scan=new Scanner(System.in); System.out.println(\ÇëÊäÈëÒ»¸öÕûÊý£º\); x=scan.nextInt(); y=x+x/10+x/100;

System.out.println(x+\¸÷¸öÊýλµÄºÍ=\+y);

}

}

µÚÈýÕÂ֪ʶµã»ã×Ü

1¡¢ ¼òµ¥if½á¹¹

if(²¼¶ûÀàÐͱí´ïʽ){ Óï¾äÒ»£» Óï¾ä¶þ£» ¡­. ¡­. }

¿ÎÌñʼÇ

2¡¢ Ò»°ãif½á¹¹

if(²¼¶ûÀàÐͱí´ïʽ){ Óï¾äÒ»£» Óï¾ä¶þ£» ¡­. ¡­. } else {

Óï¾äÈý£» Óï¾äËÄ£» ¡­. ¡­. }

3¡¢ ¸´ÔÓµÄif½á¹¹

if(²¼¶ûÀàÐͱí´ïʽ1){ Óï¾äÒ»£»

×ÊÁÏ

Ìõ¼þתÒÆ

Óï¾ä¶þ£» ¡­. ¡­.

} else if(²¼¶ûÀàÐͱí´ïʽ2){ Óï¾äÈý£» Óï¾äËÄ£» ¡­. ¡­.

} else if(²¼¶ûÀàÐͱí´ïʽn){ Óï¾äÎ壻 Óï¾äÁù£» ¡­. ¡­. } else{

Óï¾äÆߣ» ¡­. ¡­. }

4¡¢ SwitchÌõ¼þÓï¾ä

Switch(±í´ïʽ){ //¡±±í´ïʽ¡±µÄ½á¹ûÖ»ÔÊÐíchar/byte/int/shortËÄÖÖÀàÐÍ case Öµ1£º

Óï¾äÐòÁÐ1£» break; case Öµ2£º

Óï¾äÐòÁÐ2£» break; ¡­. ¡­.. case Öµn£º

Óï¾äÐòÁÐn£» break; [default£º

ĬÈÏÓï¾äÐòÁУ» break;] }

5¡¢ ÈýÔªÔËËã·û

ÅжÏÌõ¼þ£¿±í´ïʽ1£º±í´ïʽ2

ÁªÏµ¿Í·þ£º779662525#qq.com(#Ì滻Ϊ@) ËÕICP±¸20003344ºÅ-4