import java.util.Scanner;
public class BoolTest {
/**
* 比较张三的成绩是否比李四好
*/
public static void main(String[] args) {
// boolean f = true;
// System.out.println(f);
int lisiScore = 80;
Scanner sc = new Scanner(System.in);
System.out.println("请输入张三的成绩:");
int zhangsan = sc.nextInt();
boolean isZhangsanGood = zhangsan > lisiScore;
System.out.println("张三的成绩比李四好吗?" + isZhangsanGood);
}
}
public class Cp {
/**
*
*/
public static void main(String[] args) {
// 条件运算符!的用法
int c = 50;
if ((c >= 60) == false) {
System.out.println("打断腿");
}
if (!(c >= 60)) {
System.out.println("打断腿");
}
}
}
import java.util.Scanner;
public class Oushu {
/**
* @param args
*/
public static void main(String[] args) {
// 输入一个数,判断是否是偶数
Scanner sc = new Scanner(System.in);
int k = sc.nextInt();
boolean isOu = (k % 2) == 0;
System.out.println(k + "是偶数吗?" + isOu);
}
}
import java.util.Scanner;
public class Oushu {
/**
* @param args
*/
public static void main(String[] args) {
// 输入一个数,判断是否是偶数
Scanner sc = new Scanner(System.in);
int k = sc.nextInt();
boolean isOu = (k % 2) == 0;
System.out.println(k + "是偶数吗?" + isOu);
}
}
import java.util.Scanner;
public class Prize {
/**
* 根据成绩进行奖励
*/
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("请输入张浩的成绩:");
int s = sc.nextInt();
// boolean b = s > 98;
if (s > 98) {
System.out.println("奖励一个Vivo X9");
}
System.out.println("暑假开始了");
}
}
import java.util.Scanner;
public class Prize2 {
/**
* 条件运算符 &&的使用 一门课超过90,一门课超过80才有奖
*/
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("请输入张浩的java成绩:");
int java = sc.nextInt();
System.out.println("请输入张浩的音乐成绩:");
int music = sc.nextInt();
if (java > 90 && music > 80) {
System.out.println("给iphone8 作为奖励!");
}
}
}
import java.util.Scanner;
public class Prize3 {
/**
* 条件运算符||的用法,逻辑运算符的组合:
*
*/
public static void main(String[] args) {
// java超过98,music超过80,或者java满分而且music 超过70,才有奖励
Scanner sc = new Scanner(System.in);
System.out.println("请输入张浩的java成绩:");
int java = sc.nextInt();
System.out.println("请输入张浩的音乐成绩:");
int music = sc.nextInt();
if ((java > 98 && music > 80) || (java == 100 && music > 70)) {
System.out.println("有奖励");
}
}
}
import java.util.Scanner;
public class Prize4 {
/**
* if else 的用法
*/
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("请输入张浩的成绩:");
int s = sc.nextInt();
// boolean b = s > 98;
if (s > 98) {
System.out.println("奖励一个Vivo X9");
} else {
System.out.println("惩罚他继续编码!");
}
System.out.println("暑假开始了");
}
}