1 / 6

Java Basics

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

silas
Download Presentation

Java Basics

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Java Basics - Prashant Nagaraddi

  2. 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)

  3. 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

  4. 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

  5. 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 • the compiler and interpreter are in the /usr/j2se/bin directory. This should be included in your PATH • to run the compiler, just give the name of a .java file • % javac Hello.java • to run the interpreter, give the name of the bytecode file without the .class extension • % java Hello • Hello, World

  6. 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)

More Related