9:53 pm - Monday October 15, 2018

Java program to test whether a static method can access the static variable or not

CANDID INDUSTRIAL TRAINING -- CHENNAI
Corporate Training for Experienced Candidate
Struts | Hibernate | Spring | Java / J2EE
SOAP | RestFull | Design Pattern | more...
Ph: +91 72000 69003
137b, 2nd st, shanthi nagar, Chrompet, Chennai -600044

/**

*@author :CandidJava.com

*@descriptions : This program to test whether static method can access the static variable or not  using java program

*/

class Person{<strong></strong>

static{

System.out.println("Welcome");

}

{

System.out.println("Candid Industrial Training");

}

}

class B{

B(){

System.out.println("fine");

}

}

class Classinstancevar{

public static void main(String args[]){

Person a1=new Person();

}

}

Output

D:\candidjava\code>javac Classinstancevar.java

D:\candidjava\code>java Classinstancevar

Welcome

Candid Industrial Training

Filed in: Z-A All Java Codes

No comments yet.

Leave a Reply