




























































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





























































































http://www.cs.umd.edu/~pugh/java/crashCourse
What makes Java Dif ferent
2
3
4
7
8
9
10
13
14
15
This slide intentionally left blank
16
19
20
public class HelloWorldApplication { public static void main(String [] args) { if (args.length == 1) System.out.println("Hello " + args[0]); else System.out.println("Hello World"); } }
21
22
25
String count
offset
value
6
0
String count
offset
value
2
2
a
b char [ ]
length^6
0 1 2 3 4 5 π! = p i e
26
27
28
int[] array1 = {1,3,5}; int[][] a = new int[10][3]; // a.length == 10 // a[7].length == 3
a[5][2] = 42; a[9] = array1; // a[9][2] == 5
// Use of array initializers int[][] twoD = {{1,2,3},{4,5},{6}}; Object [] args = {"one", "two", a }; main(new String [] {"a", "b", "c"});
31
String
public static void printArray(Object [] a) { for(int i=0; i < a.length; i++) System.out.println("a[" + i + "] = " + a[i]); } 32
33
34
http://www.cs.umd.edu/~pugh/java/crashCourse
Objects, Classes and Interfaces
38
39
40