Given the fields must be not static , I have to take off static from main() , is this correct ?
Now if I want to print the values of my variables I get a nullPointerException .. Is this because I don't initialize it ?
Why the exercise says I won't initialize it if that causes an exception ? Do I have to catch it and return null for the caller method ?
I'm a bit lost lol.
package fr.codegym.task.task15.task1516;
/*
Valeurs par défaut
*/
public class Solution {
public int intVar;
public double doubleVar;
public Double DoubleVar;
public boolean booleanVar;
public Object ObjectVar;
public Exception ExceptionVar;
public String StringVar;
public void main(String[] args) {
System.out.println(intVar);
System.out.println(doubleVar);
System.out.println(DoubleVar);
System.out.println(booleanVar);
System.out.println(ObjectVar);
System.out.println(ExceptionVar);
System.out.println(StringVar);
}
}
}