Beginners for JAVA language

 Basics of java programming:

To write a java program, the following details, are need.

1. Command-line:
  • It describes what's going on inside a program, so that person looking at the source code does not have a hard time figuring it out.
  • That means human understanding and not be execute in output.
  • Types of comments:
    (i) Single line comments:
                 //Statements or Comment 
    (ii) Multiline comments or comments for combined in multi line:
                  /* comment */
                  /** comment */
  • A variable is nothing but it allocates the memory space and holds the values.
  • That means every memory of address is difficult to use in the program, conversely, we give that address as a simple user-defined word or character is called variable.
  • For example, each user dials the call using a contact name only not use the phone number. i.e. each user needs an easy way to access the phone number to make a call to others.
  • Here, the phone number act as a memory address and saved details of contacts called variables(this process happens in CPU).
                         Data_type variable_name;
                         int x, y;
    Rules for naming the variables:
    • The first character must be an alphabet or an underscore(_).
    • No commas or blank spaces are allowed within a variable name.
    • No special symbols, an underscore can be used in a variable name.
    Scope of variables:
    • It implies the availability of variables within the program.
    • It is divided into two types.
         (i) Local variable:
    • The variables which are defined inside the function block called a local variable.
                           public static void main (String args[])
                                  int a,b;//local variable
         (ii) Global variable:
    • The variables that are declared before the main() a function is called a global variable.
                          int a,b;//Global variable
                          public static void main (String args[])
    3.Data types:
    • The data type is the type or kind of data, that is going to process within the program. 
        Pre-defined data type:
    • The most widely used data types are
     4. Input function:
    • This function is used to get value from users.

                          Scanner object_name= new Scanner(;

                          variable_name= scanner_object_name.input_type();

    5. Input type:
    •  It is used to indicate unknown value for types to display on the output screen and also get value from the user. ( i.e. Holds unknown values).
    There are,  
    6.Output function: 
    • This function is used to show details on the output screen for user understanding.
    7.Escape sequence: 
    • This is used to align output on the screen.

    Example program:
    1. // Write a program to add two number and value get from user.

      package exampleprogram;

      import java.util.Scanner;

      public class Exampleprogram {

          public static void main(String[] args) {

             Scanner input = new Scanner(;

             int a,b;

             System.out.println("\t\t  Additions of two number.... ");

             System.out.println("\nEnter two value  : ");

             a = input.nextInt();

             b = input.nextInt();

             int c=a+b;

             System.out.println("Additions of a and b value is : "+c);




    No comments:

    Post a Comment

    Popular Posts

    Search This Blog

    Powered by Blogger.

    Blog Archive

    Service Support

    Need our help to Learn or Post New Concepts Contact me

    Blog Archive

    Recent Posts

    Service Support

    Need our help to Learn or Post New Concepts Contact me