- Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathtutorial_07.java
More file actions
Latest commit
37 lines (28 loc) · 850 Bytes
/
Copy pathtutorial_07.java
File metadata and controls
37 lines (28 loc) · 850 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
classDriver {
publicstaticvoidmain(String[] args) {
// These all make a reference with the words "Hello !" in them.
Stringmsg1 = newString("Hello !");
Stringmsg2 = newString(newchar[] { 'H', 'e', 'l', 'l', 'o', ' ', '!' });
Stringmsg3 = "Hello !";
System.out.println(msg1);
System.out.println(msg2);
System.out.println(msg3);
// different ways to declare and initialize
Stringa;
a = "alfa";
Stringb = "bravo";
Stringc, d, e;
c = "charlie";
d = "delta";
e = "echo";
Stringf = "foxtrot", g, h = "hotel";
g = "golf";
Stringi;
Stringj;
Stringk;
i = "india";
j = "juliett";
k = "kilo";
Stringl = "lima", m = "mike";
}
}