Introduction to Java programming

Introduction to Java programming

Java is an Object Oriented programming language, the syntax of Java language is similar to C and C++. compared with the C and C++ Java has some advanced features.

  • Java is portable and Platform Independent.
  • Java is Freely Dowloadable.
  • Java is Open source.
  • Java is Object Oriented , It supports all the OOPS concepts.
  • Java is secure, it is the one of the main reason to upgrade to Java from C and C++.

Steps used to Develop a Java Program

Here we are going to write the first Java Program which will print the Hello World.

  • Writing Java program:
  • Write the Java program using your favorite editor, and save the file as Class name with the extension .Java

  • Compilation:
  • Compile the Java source code into Class file using a java Compiler, Class file contains the instructions in the Intermediate language.

  • Run the class file:
  • Java interpreter converts the class file into native code and executes the program.

Here is the basic format to write the Java program, Now we will continue to discuss every part of it.

  • class:
  • Class name always starts with the capital letter, and after the class name curly brackets will start.

    “class contains the number lines of pre written code, we can build Java Applications using the classes”.In Java classes are Blueprint of, we can consider class as plan or sketch that is used to create Java Objects.

  • Syntax of Class:
  • class name should start with capital letter, and it follows Pascal Convention ie., First letter is capital letter and every first letter of next word also a capital letter. this is not mandatory to start second word also a capital letter. but for better understanding we follows some Java conventions, Further details of the class we will understand once we started the programming.

    Ex: HelloWorld, Airport, MindGame etc..

  • method:
  • A method is a set of code which does something in the program, or An method is an action that is performed by an Object.

  • Syntax of method:
  • Method name should start with small letter and follow the camel convention that means first letter of next word in the method name is a Capital letter.

    Ex: eating(), eatingMango(), playingSudokuGame() etc..

  • public:
  • we mentioned the public word before the main method it is access specifer, don’t worry about this now we will go through it later, just remember if we mentioned public other classes have access to this method, and main method shouldn’t be mentioned as private.

  • static:
  • By writing static in the method it would be accessible to the other methods metioned in the same class.

  • void:
  • void says that this method is not going to written anything. so,you can call void as a return type, like int, byte,char etc.,

    That’s all about the basic Java program further details you came to know once we entered into the Building programs see you in the next chapter :).

    Leave a Reply

    Your email address will not be published. Required fields are marked *