19 February 2014

First Java program

A demo file to initialize and display different variables:

  • Create a new class with name VariablesDemo:
public class VariablesDemo {

    public static void main(String[] args) {
   
        /* Declaration of variables  */
         int Id;
         String name;
         char gender;
         double salary;
    
         /* Initialization of variables*/
         Id = 4348;
         name = "Employer";
         gender ='M';
         salary = 25000.0;
    
        /* Display the employee details */
         System.out.println("Id : "+ Id);
         System.out.println("Name : "+ name);
         System.out.println("Gender : "+ gender);
         System.out.println("Salary : "+ salary);

        }
}
NOTE: 
  • The text between "/* " and "*/" will not be executed.They are used to write comments.
  • For single line comments use "//
 Output:(Click on the image to enlarge)
eclipse-output

Contact Form

Name

Email *

Message *

Smooth Graphics Java

// Arrange Bricks in Game //java brick breaker game code without flickering // added game levels 1,2,3 in the game //java paddle ball ga...