|
* Have you ever used Java? |
| |
|
|
|
|
Take a look at the following code, are there any errors? class HelloWorld { public static void main (String[] args) // your code goes here System.out.println("hello\nworld"); }
|
| |
|
|
|
|
Take a look at the following code, are there any errors? Class HelloWorld { public static void main (String[] args) { System.out.println("hello world"); } }
|
| |
|
|
|
|
Take a look at the following code, are there any errors? if (relative) if (my friend) cout << “both”; else cout << “neither”; |
| |
|
|
|
|
Take a look at the following code, are there any errors? char response; cout << “Please enter (y)es or (n)o ->”; cin >> response; while ((response != ’y’) || (response != ’n’)) { cout << “Please try again. Enter (y)es or (n)o ->”; cin >> response; } |
| |
|
|
|
|
Take a look at the following code, are there any errors? if (num = 100) cout << “num equals 100”; else cout << “num is not 100”;
|
| |
|
|
|
|
Take a look at the following code, are there any errors? nit count = low ; while ( count <= high ) { count++ ; } |
| |
|
|
|
|
Take a look at the following code, are there any errors? class CMconvertINCH { public static void main(String[] args) { final double CM_PER_INCH = 2.54; double paperWidth = 8.5; System.out.println("Paper width in cms: " + paperWidth*CM_PER_INCH); } } |
| |
|
|
|
|
Take a look at the following code, are there any errors? class LinePrint { public static void main (String[] args) { String line1 = (" | 1 2 3 4 5 6 7 8 9"); String line2 = (" | 1 2 3 4 5 6 7 8 9");
String newLine = System.getProperty(line.separator); System.out.println(line1 + newLine + line2);
} |
| |
|
|
|
|
Take a look at the following code and select an answer? public class SquareRoot { public static void main(String[] args) { double sqrt = 8025.73D;
System.out.println("The square root of " + sqrt + " is " + Math.sqrt(sqrt));
} } |
| |
|
|
|