Kapitel 2 Flashcards
(37 cards)
1
// A crazy mixed up program public class Columbus { public static void main(String[] args) { System.out.println("In 1492 Columbus sailed the ocean blue."); } }
2
Columbus.java
3
public class Hello { public static void main(String[] args) { System.out.println("Hello World"); } }
4
// Example // August 22, 2013 public class MyName { public static void main(String[] args) { System.out.println("Herbert Dorfmann"); } }
5
C
6
A
7
// Its a mad, mad program public class Success { public static void main(String[] args) { System.out.print("Success\n"); System.out.print("Success "); System.out.print("Success\n"); System.out.println("\nSuccess"); } }
8
The works of Wolfgang include the following
The Turkish March and Symphony No. 40 in G minor.
9
// August 22, 2013 public class PersonalInfo { public static void main(String[] args) { System.out.println("Herbert Dorfmann"); System.out.println("123 Elm Street"); System.out.println("My Town, NC 21111"); System.out.println("919-555-1234"); } }
10
Variables: little big Literals: 2 2000 "The little number is " "The big number is "
11
The value is number
12
99bottles is illegal because it starts with a number.
r&d is illegal because the & character is illegal.
13
They are not the same because one begins with an uppercase S while the other
begins with a lowercase s. Variable names are case-sensitive.
14
a) short
b) int
c) 22.1 because it is stored as a double .
15
6.31E17
16
Append the F suffix to the numeric literal, such as:
number = 7.4F;
17
true and false
18
a) char letter;
b) letter = ‘A’;
c) System.out.println(letter);
19
The code for ‘C’ is 67.
The code for ‘F’ is 70.
The code for ‘W’ is 87.
20
‘B’ is a character literal.
21
You cannot assign a string literal to a char variable. The statement should be:
char letter = ‘Z’;
22
Expression Value 6 + 3 * 5 21 12 / 2 - 4 2 9 + 14 * 2 - 6 31 5 + 19 % 3 - 1 5 (6 + 2) * 3 24 14 / (11 - 4) 2 9 + 12 * (8 - 3) 69
23
Integer division. The value 23.0 will be stored in portion .
24
a) x += 6;
b) amount -= 4;
c) y *= 4;
d) total /= 27;
e) x %= 7;