Programming with Java

Java is the second most used programming language in the world. Java is a object oriented programming language.

Characteristics of java

  • Object oriented language
  • Platform independent.
  • Strongly-typed language.
  • Interpreted and compiled language.
  • Automatic memory management.
Every java program is run on the Java Virtual Machine(JVM). It is the foundation of java platform and it is responsible for executing the byte codes and for fundamental capabilities of java.

About Java programs, it is very important to keep in mind the following points. 

1. Case Sensitivity - Java is case sensitive, which means identifier Hello and hello would have different meaning in Java. 
2. Class Names - For all class names the first letter should be in Upper Case.  If several words are used to form a name of the class, each inner word's first letter should be in Upper Case. 
Example : class MyFirstJavaClass  
3. Method Names - All method names should start with a Lower Case letter.  If several words are used to form the name of the method, then each inner word's first letter should be in Upper Case. Example : public void myMethodName() 
4. Program File Name - Name of the program file should exactly match the class name.  When saving the file, you should save it using the class name (Remember Java is case sensitive) and append '.java' to the end of the name (if the file name and the class name do not match your program will not compile). 
Example : Assume 'MyFirstJavaProgram' is the class name. Then the file should be saved as 'MyFirstJavaProgram.java' 
5. public static void main(String args[]) - Java program processing starts from the main() method which is a mandatory part of every Java program. 

Example:
class MyFirstJavaProgram {  
    public static void main(String args[]) { 
          System.out.println("Hello World");  
    } 

Data Types Of Java

In java, there are two types of data types 
1. primitive data types 
2. non-primitive data types 

Integers           byte         8bits
                        short       16bits
                        int           32bits
                        long        64bits

Real                float        32bits
                       double     64bits

Character       char          16bits

Boolean         boolean     1bit  

Above are the primitive data types.

Comments

Popular posts from this blog

C- Control Structures

C - Functions