90 likes | 162 Views
Development. Using Javac & java command. Compiling with javac. javac [ option ] [ source files]:. Compiling with -d. Launching Apps with Java. Searching for Other Classes. Declaring and Using Classpaths : - classpath /com/foo/acct:/com/foo
E N D
Compiling with javac • javac [option] [source files]:
Searching for Other Classes • Declaring and Using Classpaths: -classpath /com/foo/acct:/com/foo => means specify 2 directories where classes can be found -classpath /com/foo/acct:/com/foo:. • Search 2 directories and search current directory * Use “-cp” to abbreviate “-classpath”
Using Static Imports Before static imports: public class TestStatic { public static void main(String[] args) { System.out.println(Integer.MAX_VALUE); System.out.println(Integer.toHexString(42)); } } After static imports: import static java.lang.System.out; // 1 import static java.lang.Integer.*; // 2 public class TestStaticImport { public static void main(String[] args) { out.println(MAX_VALUE); // 3 out.println(toHexString(42)); // 4 } }