Articles & News Stories

IP

Description
Description:
Published
of 3
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Related Documents
Share
Transcript
  1.   int a=50; if (a>35) System.out.print(“Happy”);  else System.out.print(“new”);   System.out.println(“year”);   2.   int a, b=100; for (a=10 ; a<=12 ; a++) {  b+=a; } System.out.println(“ a :” + a + “  b :” +  b + “ ”) ;   3.   Rewrite the following program code using for loop: int num=6; int temp=num; while(num>=1) { temp=temp-1; if (temp%2==0) System.out.println(“Is even”) ;  else System.out.println(“Is odd”) ;  num =num-2; } 4.   Find output of a and b from following for(a=4 ; a<=12 ; a+=2) {  b=++a;  b --; }  5.   Rewrite the following code using for loop. int i=0; while(++i<20)   { if( i==8)  break; System.out.println(i++); } 6.   How many times loop will be execute : Loop1: int sum=0,i=5; do { sum+=i; i++; } while(i<5); Loop2: int sum=0,i=5; while(i<5) { sum+=i; i++; } 7.   What will be the content of jTextField1 after executing the following code: i nt num=6; num=num+1; if (num>5)  jTextField1.setText(Integer.toString(num)); else  jTextField1.setText(Integer.toString(num+5);  8.   Rewrite the following code using a for loop: int i=1,sum=0;   while (i<10) { sum+=i; i+=2; } 9.   Output of m and n : int a = 10 , b = 20 ; if ( b != a )  b = a + 1 ; else  b += 2 ;  b++ ; a++ ; 10.   What will be displayed in jTextField1 and jTextField2 after the following code is executed: int a = 12 , b = 20 ;  jTextField1.setText( a + b + ) ;  jTextField1.setText( + a + b ) ;
We Need Your Support
Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks
SAVE OUR EARTH

We need your sign to support Project to invent "SMART AND CONTROLLABLE REFLECTIVE BALLOONS" to cover the Sun and Save Our Earth.

More details...

Sign Now!

We are very appreciated for your Prompt Action!

x