Emma Vande-Wouwer wrote:Thank you for your reply, here is my command copy pasted :
"Microsoft Windows [Version 10.0.17134.228]
(c) 2018 Microsoft Corporation. All rights reserved.
Volume in drive C is OS
Volume Serial Number is 7E29-1FBC
Directory of c:\users\emmav\documents\csi
02/09/2018 13:38 <DIR> .
02/09/2018 13:38 <DIR> ..
02/09/2018 13:38 426 HelloWorld.class
02/09/2018 13:33 117 HelloWorld.java
2 File(s) 543 bytes
2 Dir(s) 57.900.068.864 bytes free
Error: Could not find or load main class HelloWorld
Manish Pamnani wrote:. . . but i couldn't figure out a way to make the "atmBalance" variable static so that it could be shared among all objects of ATM we create?
Ganesh Patekar wrote:We know field userName of object referred by one is set to "Manish" so prints Manish but you haven't set any values to other fields of object referred by one hence If you try to print any other fields of this object by invoking getter method on reference variable one like both prints 0 since we haven't set any values to these variables so they have default value 0 because atmBalance and atmPin are of int type.
Manish Pamnani wrote:
Each object have their own fields so you have to set them by invoking appropriate setter methods, to get values invoke getter methods and other method too like miniStatement and cash too on every object you create.
As Carey Brown suggested It's good to use constructor to initialize these fields and use toString method to print output.
If you haven't understood yet please go through The Java™ Tutorials: What Is an Object and What Is a Class?