Java Basics

 Founder of java : Games Gosling .

In this section let us learn about:

1.Features of Java.
2. Architecture of JVM
3.Structure of Java 
4.A Simple Java Program
  
1.Features of java

1.Simple:
                     As it contains API documentation in clear and understandable way we can easily  reuse the code and syntax from java API which was given by  Sun Micro-system     

2.Platform independent:

                                                 java language can run on any type of platform (i.e.. windows,unix, linux, Mac e.c.t) and the output will be same .Hence java can referred as "WRITE ONCE AND USE ANYWHERE".

3.Object oriented : 

                                       java supports all the below oops concepts :
            1. Object
            2. Class
            3. Inheritance
            4. Polymorphism
            5. Abstraction
            6. Encapsulation.

4.Secured:

                         java is so secure because it supports following two things mainly:
1.Does not support external pointers .
2.Program runs inside jvm.
3.Creates a byte code.

5.Robust:

                      Java is strong as it supports garbage collector which is responsible for memory management . It does not support pointers hence we can say java is Robust (which means Strong).

6.Architecture Neutral:

                                              Implementation is independent on platform.
7.Portable:

                           we can carry byte code on to any platform and can run our java .

8.High Performance:

             Java is very speed because byte code can be run very fast since it is somewhat near to machine language .

9.Multi Threading:

                              java Supports execution of different programs concurrently . Hence java supports multi threading (thread means a small program).




Architecture Of JVM







3.Structure Of java

It consists of following sections:


                             Comment Section (used to describe the program statements)

                              package Section; (create user defined packages )

                              import section; (to import packages/classes which are predefined)

                              interface section; (to create an interface)
                               {
                                    Abstract methods();
                               }
                              class ClassName
                               {
                                    public static void main(String a[])
                                      {
                                          Data members;
                                          Member functions();
                                      }
                               }

Rules:
1. write the program in an editor (Notepad or editPlus) or in an IDE like                   (ecllipse,netbeans).

2. save the file using the class name in particular folder  with an extension of ".java"(eg: d:/Programs/)

3.open the command prompt -> appropriate folder -> then compile as                 follows:
               To Compile a java use Following Syntax:
                                      
                               javac FileName.java.

               To Run a java program use Following Syntax:
                     
                            java FileName

4.A Simple java Program


                         class SimpleJava
                        {
                            public static void main(String args[])
                            {
                               System.out.println("My Simple java program");
                           }
                        }

Save as: 

SimpleJava.java

Compile :


javac SimpleJava.java

Run:

java SimpleJava

Output:

My Simple Java Program.

Comments

Popular posts from this blog

Programs on Inheritance

Arrays In Java

Java Inner Classes