Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Java Basics - Prashant Nagaraddi Features of Java Java syntax is similar to C/C++ but there are many differences too Java is strongly typed like C++ Type inconsistencies are detected at compile time Java is an Object-Oriented Language Computation is achieved via interacting objects (more on this later) Features of Java Java is an interpreted language Java source code is translated into Java bytecodes by Java compiler These form the instructions to a Java Virtual Machine (Java VM) The Java VM interprets the bytecodes and as a result, executes real machine instructions Source Code bytecode compiler bytecode file Interpreter (VM) Hello.java javac Hello.class java Features of Java Java bytecodes are machine independent This means that you can compile Java source code on one platform transfer the bytecodes to another platform and execute them using a Java VM that has been ported for that platform You can also send Java bytecodes around the Internet as data. Sending code around in this manner is called providing executable content Running the Java Compiler (javac) and Interpreter (java) On the CS dept. Solaris systems the latest compiler, interpreter and class sources (J2SE) are in the directory /usr/j2se to run the compiler, just give the name of a .java file the compiler and interpreter are in the /usr/j2se/bin directory. This should be included in your PATH % javac Hello.java to run the interpreter, give the name of the bytecode file without the .class extension % java Hello Hello, World Running the Java Compiler (javac) and Interpreter (java) On Windows 9x/2000/NT you can compile and run your programs using the Java 2 Standard Development Kit (SDK) for Windows • Latest I’ve tried is J2SEv1.3 available from http://java.sun.com • Add the “bin” directory in your java directory to your DOS PATH • Compile and run just like in Solaris a commercial Java Interactive Development Environment (IDE) such • Visual J++ (http://msdn.microsoft.com/visualj/) • CodeWarrior (http://www.metroworks.com) • VisualCafe (http://www.visualcafe.com)