Respuesta :
Answer:
if (option1.equals(option2)){
rsvp = true;
}
System.out.println(rsvp);
A full program is given in the explanation section
Explanation:
import java.util.Scanner;
public class Option {
public static void main(String[] args) {
boolean rsvp = false;
int selection;
String option1,option2;
Scanner in = new Scanner(System.in);
option1 = in.next();
option2 = in.next();
if (option1.equals(option2)){
rsvp = true;
}
System.out.println(rsvp);
}
}
Boolean variables are variables that can only take either true or false.
The required code segment is:
rsvp = false;
if (option1.equals(option2)){
rsvp = true; }
System.out.print(rsvp);
The flow of the above code segment is as follows:
- The first line initializes rsvp to false
- The next line is a conditional statement that checks if option1 and option2 holds the same value
- The third line updates rsvp to true, if the condition is true
- The last line prints rsvp (i.e. true or false)
Read more about boolean expressions at:
https://brainly.com/question/18539409