Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

I fial at java

Name: some retard 2008-03-20 11:53

   6. The following for loop will print out the first 20 squares. Convert the for loop into a while loop.

      for(int i = 1; i <= 20; i++)
         System.out.println(i + " squared is " + i * i);



While ( I <= 20) {
  System.out.println (i + “squared is” + i * i);
  i++
       }



   7. Explain the difference between a while statement and a do-while.

The while statement continually executes a block of statements while a particular condition is true which it checks first. The difference is that do-while evaluates its expression at the bottom of the loop instead of the top



   8. Given:

      final double rate = 6.25;
      char             pass =  'P';


      True or false, the following statements are correct. If false, you must Explain!

      a)    rate  =  9.35;


False. Because the expression ‘final’ was used, rate cannot be assigned a new value. Thus it remains with its first value 6.25

      b)  pass  =  "pass";


we would have to specify that the code is a string for this to work

   9. What is the output?

      int [] X = {22,44,88};
      int [] Y = {11,33,55};
      Y = X;
      System.out.println( Y[0] );
      System.out.println( X[ X.length � 1] );

 22 and 44


is this all correct?

Name: Anonymous 2008-03-20 12:34

is this all correct?
actually no.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List