Question: public class Greetings { private String greetings; public Greetings ( String greeting ) { greetings = greeting; System.out.println ( greetings ) ; } public void
public class Greetings
private String greetings;
public GreetingsString greeting
greetings greeting;
System.out.printlngreetings;
public void hello
System.out.printlnHello;
public void translate
greetings "Hola";
public void changeGreetingString greeting
greetings greeting;
public void greeting
System.out.printlngreetings;
Which of the following code segments will produce this output in the console:
"Hello"
"Hola"
I.
Greetings hi new GreetingsHello;
hitranslate;
higreeting;
II
Greetings.hello;
Greetings.translate;
Greetings.greeting;
III.
Greetings hello new Greetings;
hello.hello;
hello.translate;
hello.greeting;
IV
Greetings hola new GreetingsHello;
hola.changeGreetingHola;
hola.greeting;
Consider the following class:
public class Greetings
private String greetings;
public GreetingsString greeting
greetings greeting;
System.out.printlngreetings;
public void hello
System.out.printlnHello;
public void translate
greetings "Hola";
public void changeGreetingString greeting
greetings greeting;
public void greeting
System.out.printlngreetings;
Which of the following code segments will produce this output in the console:
"Hello"
"Hola"
I.
Greetings hi new GreetingsHello;
hitranslate;
higreeting;
II
Greetings.hello;
Greetings.translate;
Greetings.greeting;
III.
Greetings hello new Greetings;
hello.hello;
hello.translate;
hello.greeting;
IV
Greetings hola new GreetingsHello;
hola.changeGreetingHola;
hola.greeting;
I, III and IV
IV only
I and III
I and IV
II only
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
