Type Promotion
Type Promotion
class Student{
int rollno; //instance variable public class Test{
String name; public static void main(String args[]){
s1.display();
Student(int r, String n){ s2.display();
rollno = r; }
name = n; }
}
void display ()
{
System.out.println(rollno+" "+name+" "+college);
Java static method
•A static method belongs to the class rather than the object of a class.
•The static method can not use non-static data members or call non-static methods
directly.