Java: why don't these variables initialize? -
I am working on an example from Bruce Single's book and I was wondering why the initial value would not touch when I Output them?
class initial valve 2 {boolean t = true; Four c = 'x'; Byte B = 47; Small s = 0xff; Int i = 99 9; Tall l = 1; Float F = 3.14F; Double d = 3.1415 9; Initial value reference; Void printInitialValues () {System.out.println ("Data type initial value"); System.out.println ("boolean" + t); System.out.println ("four [" + "+" +] "); System.out.println ("byte" + b); System.out.println ("small" +); System.out.println ("int" + i); System.out.println ("tall" + l); System.out.println ("float" + F); System.out.println ("double" + D); System.out.println ("References" + Reference); } // and printed evaluations public static wide menu (string agre) [initial values iv = new initial values (); Iv.printInitialValues (); // new initial value () PrintInitialValues (); } // end main}
all variable output 0 and zero value
I am seeing a problem that variable is declared in the class, which is called initial values 2, still you are calling the print initial values () method on the object which is of initial values. It appears that you are never calling your print initial value () method.
Comments
Post a Comment