answersLogoWhite

0

How do you write an if statement on java?

Updated: 8/10/2023
User Avatar

Theoden

Lvl 1
14y ago

Best Answer

Very simple example of an If statement checking a password just so you can see the syntax..



if (Password.equals("Password123"))
{
System.out.println("Welcome");
}
else
{
System.out.println("Incorrect Password");
}

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you write an if statement on java?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What does do in java?

You never write "do" seperately in Java. The only situation I can think of when you have to write "do" is in the "do while" statement. This is the syntax: do { statement(s) } while (expression);


What does INS do?

You never write "do" seperately in Java. The only situation I can think of when you have to write "do" is in the "do while" statement. This is the syntax: do { statement(s) } while (expression);


Write Four different java statement that each add to integer variable x?

++x; x++; x += 1; x = x + 1;


What advantage does Java's break statement have over C's break statement?

They do the same thing, but only the former can be used in a Java program.


How to write an if then statement in java?

<if_stmt> --> if(<expr>) {<stmt>} else [<stmt>] for example if(x>y){ max=x; }else [optionally] { max=y; }


What are semicolons used in java?

to end a statement


What is case in java?

Case is used to label each branch in the switch statement in Java Program


What is a simple java code and explain what the code does?

int a;This simple Java statement declares an integer.


Can we add website link when we write java program?

yes ,i can add the website link in java program when we write.


What is the use of switch statement in java?

In java, a switch statement is used to simplify a long list of 'if' statements. A switch statement takes the form of:switch (variableName){case condition1; command1;case condition2; command2;...}


How do you write a java program for finding multiligual languages?

You can use Java's built-in functions to write a code that will find multilingual languages.


Can you do java keylogger?

Yes, it is possible to write a keylogger in Java, but you would need to use the Java Native Interface to do so.