-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathtutorial_07.java
More file actions
37 lines (28 loc) · 850 Bytes
/
tutorial_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
class Driver {
public static void main(String[] args) {
// These all make a reference with the words "Hello !" in them.
String msg1 = new String("Hello !");
String msg2 = new String(new char[] { 'H', 'e', 'l', 'l', 'o', ' ', '!' });
String msg3 = "Hello !";
System.out.println(msg1);
System.out.println(msg2);
System.out.println(msg3);
// different ways to declare and initialize
String a;
a = "alfa";
String b = "bravo";
String c, d, e;
c = "charlie";
d = "delta";
e = "echo";
String f = "foxtrot", g, h = "hotel";
g = "golf";
String i;
String j;
String k;
i = "india";
j = "juliett";
k = "kilo";
String l = "lima", m = "mike";
}
}