Page 3 :
UNIT I INTRODUCTION TO JAVA, L Introduction to Java, Mn an object-oriented programming language developed by Sun, Microsystems, a company best known for its high-end Unix workstations, • Java is modeled after C++, *Java language was designed to be small, simple, and portable across platforms, and operating, systems, both at the source and at the binary level (more about, this later)., Java also provides for portable programming with applets. Applets appear in a, Web, Page much in the same way as images do, but unlike images, applets are, dynamic and interactive., Applets can be used to create animations, figures, or areas that can respond to, imput from the reader, games, or other interactive effects on the same Web, pages among the text and graphics., 1.1 Java Is Platform-Independent, Platform-independence is a program's capability of moving easily from, one, computer system to an, er., Platform independence is one of the most significant advantages that Java has over, other programming languages, particularly for systems that need to work on many, different platforms., Java is platform-independent at both the source and the binary level., 1.2 Java Development Kit (JDK)- Byte code, Bytecodes are a set of instructions that look a lot like machine code, but are not, specific to any one processor, Platform-independence doesn't stop at the source level, however. Java binary files, are also platform-independent and can run on multiple platforms without the need to, recompile the source. Java binary files are actually in a form called bytecodes., 1.3 Object-Oriented Programming, Many of Java's object-oriented concepts are inherited from C++, the language on, which it is based, but it borrows many concepts from other object-oriented languages, as well., Scanned by CamScanner
Page 4 :
outpat capabilities, and ofther utility functions., functions., platforms as all Java applications are., 14 Creating a simple Java Program, Hello World example:, class HelloWorld, public static void main (String args[]) {, System.out.printin("Hello World! "):, This program has two main parts:, All the program is enclosed in a class definition- here, a class called, Hello World., The body of the program (here, just the one line) is contained in a method, (function) called main(). In Java applications, as in a C or C++ program, main() is, the first method (function) that is run when the program is executed., 15 Compiling the above, program:, In Sun's JDK, the Java compiler is called javac., javac HelloWorld.java, When the program compiles without errors, a file called HelloWorld.class is, created, in the same directory as the source file. This is the Java bytecode file., Then run that bytecode file using the Java interpreter. In the JDK, the Java, interpreter is called simply java., [., java HelloWorld, If the program was typed and compiled correctly, the output will, be : "Hello World!", Scanned by CamScanner