Question: Why do you have to import those classes? The classes are public so why do you have to import them? Consider codes of 3 java

 Why do you have to import those classes? The classes are

public so why do you have to import them? Consider codes of

3 java files: //Planet.java package com.skillcertprokhattry.galaxy; public class Planet { String name;

public Planet(String name) { this.name = name; } public String toString() {

Why do you have to import those classes? The classes are public so why do you have to import them?

Consider codes of 3 java files: //Planet.java package com.skillcertprokhattry.galaxy; public class Planet { String name; public Planet(String name) { this.name = name; } public String toString() { return "Planet: + name; } } //Creator.java package com.skillcertprokhattry.oca; public class Creator { public static Planet create() { return new Planet("Earth); } } [/TestCreator.java package com.skillcertprokhattry.oca.test; public class TestCreator { public static void main(String[] args) { System.out.println(Creator.create()); } } And below options: 1 Add below import statement in Creator.java file: import com.skillcertprokhattry.galaxy.Planet; 2 Add below import statement in Creator.java file: import com.skillcertprokhattry.oca.test. TestCreator; 3 Add below import statement in TestCreator.java file: import com.skillcertprokhattry.oca.Creator; 4 Add below import statement in TestCreator.java file: import com.skillcertprokhattry.galaxy.Planet; Which of the above options needs to be done so that on executing TestCreator class, "Planet: Earth" is printed on to the console? Please note: Unnecessary imports are not allowed. Only 1 Only 2 Only 3 Only 4 1 & 2 only 1 & 3 only

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!