Java programming for beginners
前往频道在 Telegram
Learn java programming through quizzes and videos
显示更多未指定国家未指定类别
2 941
订阅者
无数据24 小时
无数据7 天
无数据30 天
帖子存档
import java.util.Scanner;
public class NameEvaluation {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.print("Enter a number from 1 to 9: ");
int number = scanner.nextInt();
if (number >= 1 && number <= 9) {
if (number % 2 == 0) {
System.out.print("Enter your name: ");
scanner.nextLine(); // Consume the newline character left by nextInt()
String name = scanner.nextLine();
System.out.println(name + " is good");
} else {
System.out.print("Enter your surname: ");
scanner.nextLine(); // Consume the newline character left by nextInt()
String surname = scanner.nextLine();
System.out.println("Name is worst");
}
} else {
System.out.println("Invalid input. Please enter a number between 1 and 9.");
}
scanner.close();
}
}
17 8月 2023, 01:14
Ni to eclipse me class bana ke copy paste krne eclipse khud execute kr dega
02 6月 2023, 11:08
Guys do vote, it will really help to see how many of you are able to write and if facing any issues discuss in group
02 1月 2022, 09:05
arun Reddy welcome to the group. To learn how to crack coding exams
11 3月 2022, 05:06
Ssekagya Ronald welcome to the group. To learn how to crack coding exams
22 8月 2023, 02:09

