Static Method in Java

Page 1

Static Method in Java tccicomputercoaching.com The static keyword in Java is used for memory management mainly. If you apply static keyword with any method, it is known as static method.

All the instance of the class share the same copy of the variable, a static variable can be accessed directly by calling “<<ClassName>>.<<VariableName>>� without need to create instance for the class. class Student{ int rollno; String name; static String college = "ITS"; //static method to change the value of static variable static void change(){ college = "BBDIT"; } //constructor to initialize the variable Student(int r, String n){


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.
Static Method in Java by Rosario Riley - Issuu