feel stupid for asking this but in java, to create an object of a class i thought you needed the class name then the name of the object you wanted to create.. like this
Student student1 = new Student();
but in this tutorial i am following the author created 2 Image objects in a different way:
plane = new Image("data/plane.png");
land = new Image("data/land.jpg");
what is he doing above? is he creating 2 Image objects or is he doing something else? is this not the correct way to create an object below?:
Image plane = new Image("data/plane.png");
Image land = new Image("data/land.jpg");
noob question
Image plane = new Image("data/plane.png");
Image land = new Image("data/land.jpg");
Declares two new variables of type Image and initializes them with two newly created objects.
plane = new Image("data/plane.png");
land = new Image("data/land.jpg");
Assigns two newly created images to two variables that already exist, that is, that were already declared and may already contain some values that are going to be replaced.
Image land = new Image("data/land.jpg");
Declares two new variables of type Image and initializes them with two newly created objects.
plane = new Image("data/plane.png");
land = new Image("data/land.jpg");
Assigns two newly created images to two variables that already exist, that is, that were already declared and may already contain some values that are going to be replaced.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement