> Incompatible types error in Java. Any help appreciated.?

Incompatible types error in Java. Any help appreciated.?

Posted at: 2014-12-18 
My guess not seeing the student class is change this line:

student3 = student3.changeName("Bill");

to this:

student3.changeName("Bill");

You need to look at what type the method changeName in the Student class returns. If it doesn't return anything, or if it returns something other than an object of type Student, then that statement won't work.

Hi, I've been working on a question for a Java class recently and have encountered an error i'm not sure how to fix. Here is the Java class and I hope you guys can help me better understand what's wrong.

public class Question1

{





public static Object[] question1()

{

// Your Code Goes Here



Student student1 = new Student();

Student student2 = new Student("Richard Rosby", 23);

Student student3 = student2;

student3 = student3.changeName("Bill");

String oldName = student2.getName();

String newName = student3.getName();







// Necessary for Unit Test. Do not remove or modify!

return new Object[] {student1, student2, student3, oldName, newName};

}





}