Question
// Class example from book on Object locations -Comping objects (addresses) public class DemoA { public static void main(String[] args) { double average; StudentA std1,
// Class example from book on Object locations -Comping objects (addresses) public class DemoA { public static void main(String[] args) { double average; StudentA std1, std2, std3; //Declare objects of type Class // Build student objects using "default" constructor std1= new StudentA(); //Create new object belonging to Class // stores the reference (pointer) to that object in , System.out.println("std1 memory pointer in hex " + std1); std2= new StudentA(); //create second object belonging to Class // stores reference to that object in which is different for System.out.println("std2 memory address in hex " + std2); std3=null; System.out.println("std3 memory address in hex " + std3+" "); // outputs the Hex the point of std1 std3= std1; //copy the "reference" value (memory address) of std1 into std3 not eh Object itself System.out.println("std3 memory address in hex " + std3); // outputs the Hex the point of std1 // // add data in to object and std1.name="Joe"; std2.name="Bill"; System.out.println("std1 name " + std1.name); // Joe System.out.println("std2 name " + std2.name); // Bill System.out.println("std3 name " + std3.name); // Joe again // Arrays in Student class System.out.println("array in class student std1 "+std1.testArray ); System.out.println("array in class student std2 "+std2.testArray ); System.out.println("array in class student std3 "+std3.testArray ); average= std1.getAverage(); // "call" method in class Student System.out.println(std1.name +" average " + average); }// End Main }//End Class
Might someone tell me why those error occurred and how to fix them ?
it say: student A cannot be resolved to a type
ava Java StudentB/src/ DemoAjava Eclipse File Edit Source Refactor Navigate Search Project Run Window Help Package Explorer 3 student A 2 ClassStep by Step Solution
There are 3 Steps involved in it
Step: 1

Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2

Step: 3

Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started