Posts

Showing posts with the label methods

Variable and Method types in JAVA

Image
  Variable types..... 1) Local variables/method local they are inside a method. eg :- class A {         void a () {         String x ;         }           } 2) Instance variables the variables inside a class. but cannot be inside a method. eg :- class B {          String x ;         } 3) Static variables/class variables Static variables must be in a class. but it cannot be inside a method. eg :- class A {          static String x ;         }            Method types..... 1) Pre - defined methods. - pre built methods in JDK - public static  void main (String[]args) {} - print (); - get (); - set (); 2) User - defined methods. - methods created by the user. -2 types static methods - static void draw () {} non static nethods - void eat () {} / void write () {}   ...