Sie sind auf Seite 1von 9

CORE JAVA SYLLABUS

Part I
1) 2) 3) 4) 5) History & Basic Concepts OOPs Class/Object Encapsulation/Polymorphism/Inheritance Interfaces

Part II
1) 2) 3) 4) 5) Packages Exception Handling Threads I/O Streams Collections

Part III
1) 2) 3) 4) AWT Swings Applet 1.7 features

PART I

HISTORY & BASIC CONCEPTS


In 1991, James Gosling delivered a lecture in Sun Microsystems on future technology that he want to implement in the real world i.e., Genie Technology. Genie Technology is something which is more powerful and it can control the electronic devices that were using in a home or office. Genie Technology can provide the communication between electronic devices which will become advancement in the real world. He wants the entertainment at the doorsteps of the user through the cable line. He also delivered the advantages of Genie Technology. Then the experts also said that it would require the hardware improvements also. James Gosling explained that they need hardware where it contains small tight code and platform/hardware independent code. The audience were so excited and Sun Microsystems gave permission to develop the project and named it as Green Project. They have started the project and at a particular point the team of James Gosling got a hurdle. It was the language which does not gives small tight code. Some of the team members advised to stop the project. James Gosling decided to design a language. One of his team member also said that implement the security in that language. After 14 days he came up with a language which is platform/hardware independent, secure at language level and can produce small tight code. They started the project and in late 1993, they finally came up with the project named as *7 (Star Seven) which is a remote control. Now all the team members want to market their product and they approached some of the companies for manufacturing the remote control in large scale. But the companies rejected them. Gosling decided to produce a movie. While the movie is going on, the audience got the poll of some of the situations that can controlled by the remote control. It was succeeded but the audience were not interested in that remote control. Sun Microsystems called back the James Gosling team and kept their project aside. In 1991, people are slowly addicting to use Internet and WWW is growing. At that time the Internet is used for only data transferring from one system to another system. The Internet Community is formed and they are getting the some of the requirements saying increase in the bandwidth which is not supportable at that time, having a small tight code that is easier to travel in the internet, platform/hardware independent code and secure transfer of data. James Gosling heard the news and he thought that it was the language that he designed for the project can be useful for the Internet Community. James Gosling wants to register the language with the name Oak Programming where he designed the language by observing the Oak tree. Somebody has already registered that name. Gosling and his team came back and having a coffee. Gosling immediately said that it was a nice coffee. Someone of his team responded that the coffee beans are coming from the place named JAVA. Then James Gosling registered the name with Java and he makes the hot coffee cup as the Java emblem.

A language is said to be 100% Object Oriented language, if that language is having everything inside classes and objects. SMALLTALK is the 100% Object Oriented Language. In case of C++, the main() is written out of the class. But in Java the main() is also placed inside the classes. So Java is more Object Oriented than C++. Java is strictly typed language and it is very much case sensitive. Even the name of the program is case sensitive. The name of the file must be match with the name of the program which hold the main(). But this is not a rule. It can be contradictory. WHY JAVA IS SUCCEEDED? Java is platform/hardware independent. Java provides small tight code. Java is secure at language level itself. Why Java is Platform/Hardware independent? If we write a C program and if we press Ctrl+F9, then the program will be converted into machinery language on which the compiler is installed. If the system is built with 8086 processor, then it will give the object file which is supportable with the 8086 instruction set. Now if we want to run that object code in 8088 enabled system, it wont work. Because the 8088 processor instruction set is different from the 8086 instruction set. There we need to again compile the program and then we need to run it on 8088 enabled system. This shows the platform independence of C and other languages. If we come to Java, James Gosling himself designed that language in such a way that there is a virtual machine which has its own instruction set. Virtual machine is a simulated version of CPU. This virtual machine is called Java Virtual Machine (JVM). JVM now takes the programs written in java and compile the program to give an intermediate code called Byte Code. This byte code is similar, if we run the JVM on different machines. JVM first identify the machine on which it was installed and it will convert the byte code into machine understandable code which was supportable for the processor on which it was running. JVM already know about the machine on which it was installed and the Operating System that was running on that machine. If at all, any new OS is available in the market means, JVM need to upgrade and that upgraded version must be installed for smooth running of java. Till today java become the platform/hardware independent. What is Java? Java is referring to an architecture named Java Architecture which has four components.

1. Java Language It is a programming language that follows Object Oriented approach. 2. Java Byte Code 3. Java Virtual Machine 4. Java API. What is Java API? An API is an Application Programming Interface. A java API is a collection of the number of classes. Actually, Java has two environments. 1. Compile Time Environment or Design Time Environment. 2. Rub Time Environment. Java can be used for writing the applications that are supportable for any electronic device. Depending on the electronic device, the java programs may change or entirely java application may change. Source code is stored in .java files and Byte Code is stored in .class files. In geographical aspects, the compile time and run time environments may be different and we need to connect these environments physically.

JVM and Java API collectively called as Java Platform and it is available for any electronic device where java is the programming language of the respective electronic device. What is JVM? JVM can be viewed in three different perspectives. 1. Specification 2. Implementation 3. Run Time Instance

JVM Specification: Specifications are set by the Sun people describing the rules that need to design the JVM. Anybody can design the JVM by following the specifications set by the Sun people. It was the theoretical representation in which it says the JVM need to do but not specifying how to do. JVM Implementation: It is a programmatic approach following the specifications led by the Sun people saying how to do. So many companies have implemented the JVM and each JVM follows the specification as specified. Run Time Instance: If any user downloaded the JVM and installed in his PC, then it is run time instance. The JVM that was downloaded by the user may be implemented by a company following the specifications led by the Sun people. There are three ways to implement the JVM. 1. Hardware Implementation. 2. Software Implementation. 3. Mixture of both Hardware and Software Implementation. JVM is designed using the interpreter in the olden days. It is very slow at that time. After some years, developments have been made to the JVM and designed the Just In Time Compiler. Due to the improvements made by the Sun people, the speed of execution is relatively increased. Today the JVM is available as Code Optimizers. These are very fast. Why Java can produce small tight code? Let us consider an instruction size in the C language is 2 bytes. That means the .exe file having the instruction size of 2 bytes and if the file is having 10 lines then the total file size is 20 bytes. If we consider a Java program, each instruction size in the byte code is 1 byte. So the name Byte Code is came into existence. That means the size is became half of the single C/C++ instruction in the .exe file. Entire code in Java program can be modulated and for every module can produce a .class file which is independently executable. Thus Java can produce the small tight code. How Java is secure at language level?

Security is an important feature that no language can adopts at language level. James Gosling himself designed Java in such a way that the security is an added advantage. He followed the SANDBOX security model. In Java, the security is implemented in 3 ways. 1. Class Loader 2. Byte Code Verifier 3. Security Manager Class Loader: Class loader is the one which loads the .class files into memory. It is the first level of security check. The minimalistic checks are done at this level and then it passes the security check ups to second level. Here the file will be loaded into memory that wants to run by the JVM. This stage of verification can easily cross even if the .class file contains wrong code. Byte Code Verifier: It is the second level of the security check ups. Here the byte code will checked whether the byte code embedded in the file is following the specifications that were laid by Sun Microsystems or not. If not, simply the byte code verifier will reject. If yes, the code will be passed to next stage of security check up. This stage of verification can also easily cross even if the .class file contains wrong code. Security Manager: This is the final stage of security checking and here the security manager will check the entire file that being executed. This cannot be easily cross by any individual. Editions of JAVA: The three editions of Java are 1) J2SE: Java 2 Standard Edition which is helpful in developing programs that is useful for the simple applications. 2) J2EE: Java 2 Enterprise Edition which is useful in developing the complex applications. 3) J2ME: Java 2 Mobile Edition which is useful for the various electronic devices. These applications are useful in running the programs intended to electronic device applications. Installation of J2SE: Download the J2SE from Oracle Website. Check the configurable software that matches with the OS and the hardware.

After installing, the Java folder is settled in the C:\Program Files. Inside the Java folder the different folders available are: 1) Jdk 1_x 2) Jre 1_x Where x stands for the version we downloaded. Jdk is Java Development Kit which provides a host of utilities. JRE is the Java Runtime Environment and which is used for running the programs. Why to set the PATH? To compile the Java programs, the compiler is available in the bin directory with the name javac.exe. By setting the Path we are saying the location of the java compiler to compile the programs. If we type a command at the CMD, then DOS will search for the command with .com as extension thinking that the command as an internal command. For Example, if we type CD at the command prompt then, DOS checks for the cd.com. If it not found then it will try for the cd.exe and if it fails then it checks for the cd.bat. Like that if we type javac, DOS will checks for the javac.com which will not there in the directory. Then it checks for javac.exe and then javac.bat which are not available in the directory structure. PATH is one which says the DOS to check in the specified path that was provided by the user or administrator. Utilities The Utilities in Java can be available in the BIN directory. The list of utilities is: 1) Javac: It is used for compiling the program and converts a java file into class file. Helps in giving the Byte Code. 2) Java: It will begin the JVM and it will execute the .class file. 3) Javadoc: It is a built in tool for generating documentation. 4) Javap: It is a Java DIS Assembler which is used for reverse engineering. This cannot get .java file from a .class file. Upto a certain extent the information can be given back by javap. 5) Javah: It is a Java Native Interface (JNI). It helps us to implement the JNI which invokes the native code from a java program. A native code is such code which is written in other language. Javah provides header file which will decrease the inconsistency of java and native code. 6) Jar: It is a java archive used to compress the files. 7) Jdb: It is a java debugger to trace the program without any IDE.

8) AppletViewer: To test the applets whether they are working or not. 9) Jarsigner: Uses the keytool and policytool. 10) Keytool: Helps in converting the untrusted applet and provides the keys for network security. 11) Policytool: Used to create the policy of JVM. How many types of programs created in Java? Two types of programs are created using Java 1) Application 2) Applet 1) Application: We can create Console Applications and the Graphical User Applications. 2) Applets: These are the special type of applications that can enhance the webpage with the dynamic content. These are very responsive and more dynamic. These can be embedded into HTML pages and make the web page more interactive. They are automatically downloadable and run in the client machine. JVM default action on the applets is not to touch the local resources. This behaviour can be changed by a user if he wants. Two types of applets are there: 1) Signed Applets or Trusted Applets: These are one which has their own behaviour which was set by user. 2) Unsigned Applets or Untrusted Applets: These are the one which has the default behaviour and they can be converted into signed applets. First Program in Java: public class HelloWorld { public static void main(String args[]) { System.out.println(Hello World); } }

The first line of the program is the declaration of the class. public is the access specifier

Das könnte Ihnen auch gefallen