Java Programming Tutorial – 05 – Storing and Accessing Instance Variables of an Object

///Java Programming Tutorial – 05 – Storing and Accessing Instance Variables of an Object

Java Programming Tutorial – 05 – Storing and Accessing Instance Variables of an Object

FavoriteLoadingAdd to favorites

Get more lessons like this at

Java468x60

Learn how to program in java with our online tutorial. We will cover variables, loops, if else branching, arrays, strings, objects, classes, object oriented programming, conditional statements, and more.

Here we learn how to store instance variables as part of an object and learn how to use them and access them in the program.

source

By |2020-07-25T08:31:46+00:00July 25th, 2020|Java Video Tutorials|20 Comments

20 Comments

  1. Joe July 25, 2020 at 8:31 am - Reply

    Should we type "static" before we define a class aircraft, otherwise it will pop up error Error:(5, 32) java: non-static variable this cannot be referenced from a static context

  2. Johannes Dimopoulos July 25, 2020 at 8:31 am - Reply

    These videos are fantastic. Thank you!

  3. Collin Keegan July 25, 2020 at 8:31 am - Reply

    Microsoft Flight Sim is coded in Java, Colorized, circa 2008.

  4. Mahmoud Shawish July 25, 2020 at 8:31 am - Reply

    please where can i fined the exercises ???

  5. cole wilkie July 25, 2020 at 8:31 am - Reply

    Hi, I don't know if you or anyone else can help but my program is throwing this error:

    Customer.java:108: error: invalid method declaration; return type required

    customer(String firstNameIn, String lastNameIn){

    ^

    1 error

  6. Supratim Chakraborty July 25, 2020 at 8:31 am - Reply

    It's all depends on the teacher I would say…..everybody is not a teacher. But you are. The explanation was great, I've tried several other videos on the same topic from different instructors but finally I stopped here.
    Awesome and Thank you Sir! 🙂

  7. mutaz kanaan July 25, 2020 at 8:31 am - Reply

    this Chanel is a treasure of information

  8. misterbowzer July 25, 2020 at 8:31 am - Reply

    This video saved me from getting an F for my mid-term. You explained it way better than my instructor in college. Thanks!

  9. Jon Marsh July 25, 2020 at 8:31 am - Reply

    where are the exercises?

  10. Yonas Abraha July 25, 2020 at 8:31 am - Reply

    Thank you so much. Your java videos helps a lot

  11. Patrick Highley July 25, 2020 at 8:31 am - Reply

    By far the easiest to understand. Thanks and keep it up.

  12. Pantheon July 25, 2020 at 8:31 am - Reply

    If you, for example, make a new Class in your package and want to access and save the data in an array (what type of model, how much space is in their, their line of production with a limit of 100). How would you do it? (or if there is a video which covers a similar problem please tell me). Thanks in advance!

  13. EverydayHacker22 July 25, 2020 at 8:31 am - Reply

    I wish my java teacher would explain like you do. doing my assessment now based on your videos not on the books I re read twice over 200 pages of nothing.

  14. Luingus July 25, 2020 at 8:31 am - Reply

    What are you referring to when you say “the excersizes”

  15. I LOVE COMPUTERS July 25, 2020 at 8:31 am - Reply

    Finally i found someone who knows how to teach Java

  16. 冯建鈞 July 25, 2020 at 8:31 am - Reply

    Thank you ,you are a lifesaver man

  17. Jake Loeppky July 25, 2020 at 8:31 am - Reply

    How does one dynamically reference an object variable. I'm creating a ghetto Monopoly game in Java. I have a Position class and a Monopoly class that has my main in it. From the Monopoly class I have Position object variables for each place to land on. How can i dynamically reference Monopoly.mediterranean.owner dynamically so that I don't have to make an if statement for each individual place to land on?

    I have something like below but haven't sorted how to get it to work.

    if(Monopoly.meditteranean.available==true){//prompt whether to buy or not}
    I'd have to make 26 statements this way

    I want to be able to return the variable name from a method and reference it dynamically. Obviously what I have down below doesn't work but I think it demonstrates what I'm trying to do.
    if(Monopoly.place(num).available==true){//prompt whether to buy or not}
    public static String place(int num){
    if(num==1){
    return "mediterannean";
    }
    }

  18. JSX 03 July 25, 2020 at 8:31 am - Reply

    Just wanted to say thank you.

  19. Kurtney Jantjies July 25, 2020 at 8:31 am - Reply

    i wish all my lecturers could explain like you, Thank you, you're the best!!!

  20. YOU WANG July 25, 2020 at 8:31 am - Reply

    just wonder why you said that it is like a Hieratical thing at 5:20. most of them may be like this way as you said, but I just think of some exceptions like

    Scanner sc = new Scanner(System.in);
    do {…

    System.out.println("DO YOU WANT TO CONTINUE ?(Y/N");

    answer = sc.next();
    }
    while (answer.equalsIgnoreCase("Y"))

    like here, the dot between the answer and method, obviously equalsIgnoreCase is just a method from other class, it is not a part of the answer itself.
    Always enjoy your video, you make java more understandable than my professor lol
    I count on your video to pass the class
    but this point just makes me so confused.

Leave A Comment

*