• RubyonRails
  • Core Java
  • Spring
  • JavaScript
  • PHP
  • Servlet
  • Struts
  • Java IO
  • SQL Tutorial

  • <

    What is Java Variable and Datatypes

    Variable is memory location name to be allocated.There are three types of variables in java:


    Java Variable Types


  • local variable

  • instance variable

  • static variable

  • Local variables are declared in method, constructor, or block.
  • Instance variables declared inside class, but declared outside a method.
  • static variables declared using static keyword in a class,


  • Java Variable and Datatypes Example


    class A{  
    int data=50;//instance variable  
    static int m=100;//static variable  
    void method(){  
    int n=90;//local variable  
    }  
    }
    



    Java Data types

    int(Data type) a,b,c;
    
    float(Data type) pi;
    
    double(Data type) d;
    
    char(Data type) a;
    
    















    © copyright 2017-2021 Completedone pvt ltd.