Given:

public class Main {
	class Student {  //line 1
 		String classname;
 		public Student(String classname) { //line 2
  			this.classname = classname;
 		}
	}
	public static void main(String[] args) {
 		var student = new Student("Biology"); //line 3
	}
}

Which two independent changes will make the Main class compile? (Chosoe two)

Change line 1 to static class Student {

Move the entire Student class declaration to a separate Java file, Student.java

Change line 1 to public class Student {

Change line 2 to public Student(String classname)

Verified Answer
Correct Option - ab

To get all Infosys Certified Java SE11 Developer Exam questions Join Telegram Group https://rebrand.ly/lex-telegram-236dee

Telegram