1
6 class Jonotesti {
7
8 private static void tulosta(boolean b) {
9 if ( b ) System.out.println("Samat ovat");
10 else System.out.println("Erilaiset ovat");
11 }
12
13 public static void main(String[] args) {
14 String s1 = "eka";
15 String s2 = new String("eka");
16
17 tulosta(s1 == s2); tulosta(s1.equals(s2));
20 int i1 = 11;
21 int i2 = 10 + 1;
22
23 tulosta(i1 == i2);
25 Integer io1 = new Integer(3);
26 Integer io2 = new Integer(3);
27
28 tulosta(io1 == io2); tulosta(io1.equals(io2)); tulosta(io1.intValue()== io2.intValue());
32 s2 = s1;
33 tulosta(s1 == s2);
35 }
36
37 }
38