>

Sunday, December 16, 2012

Java program using Constructor

What is the output?

public class SaravananK {

    static int x=4;

    public SaravananK() {

        System.out.print(this.x);

          }   
public static void main(String[] args) {
     
         System.out.println(new SaravananK().x);
    }

}

No comments:

Post a Comment

Please post your comments. Your comments make us to write more programs for you.