How do you write a conditional statement?



How do you write a conditional statement?..

Answer / Virendra Kumar

In Java, a conditional statement can be written using 'if', 'else if', and 'else' clauses. For example: 'if (condition) { /* code to execute if condition is true */ } else if (otherCondition) { /* code to execute if the first condition is false but the other condition is true */ } else { /* code to execute if neither of the conditions are true */ }'.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

Why volatile is used in java?

1 Answers  


Write a program to print 15 random numbers using foreach of java 8?

1 Answers  


What is a serializable interface?

4 Answers  


What is a null check?

1 Answers  


Can we create our own daemon thread?

1 Answers  


What is the difference between notify and notifyall method?

1 Answers  


In what types of operations an ArithmeticException will be thrown?

3 Answers  


what is mena by object block any what is the use of that

1 Answers   CGI,


How do I enable java in safari?

1 Answers  


why java main method is given as static method?

2 Answers  


Explain the difference between association, aggregation and inheritance relationships.

1 Answers  


What are the different ways of implementing thread? Which one is more advantageous?

1 Answers  


Categories