Java:Static Object Creation | Selenium Forum
M
Posted on 08/11/2015
Hi Ashish,

i was practising the exercise on Traningn Day 3 about Obejct oriented programing concepts.
In the below Question i get the output as
null 0.

I did not undetstand how.
i want to know the meaning of this code "static Javaclass obj";

To create an object we normally use a new kewword with the Class name, but what is static object?



16) What will be output of follwoing?
class JavaClass {
static int i;
static JavaClass obj;
public static void main (String[] args) {

System.out.println( obj + "" +i);


}}

Reagrds
Abdul

M
Replied on 08/11/2015

this blog will tell you all about static methods, static blocks and static variables.

http://crunchify.com/java-static-methods-variables-static-block-and-class-with-example/