摘要: 生成输入框 String numberString1 = JOptionPane.showInputDialog("Enter the first number: "); 生成消息框 JOptionPane.showMessageDialog(null, number1 + " <= " + num 阅读全文
posted @ 2022-05-11 15:47 Scenery_Shelley 阅读(25) 评论(0) 推荐(0)
摘要: ax^2 + bx + c = 0 import javax.swing.JOptionPane; import java.util.*; class Main { public static void main(String[] args){ Scanner input = new Scanner 阅读全文
posted @ 2022-05-11 14:54 Scenery_Shelley 阅读(34) 评论(0) 推荐(0)
摘要: [0,20) [10,20) [10,50] import javax.swing.JOptionPane; import java.util.*; class Main { public static void main(String[] args){ int number = (int)(Mat 阅读全文
posted @ 2022-05-11 13:04 Scenery_Shelley 阅读(34) 评论(0) 推荐(0)
摘要: 运算符优先级表(从高到低) ++在前,先变后用,++在后,先用后变 var++ var--() +、-(一元加减)、++var 、--var 、(type) ! 、/、% 、-(二元加减) <、<= 、> 、>= == 、!= ^ && | | = 、+= 、-= 、*= 、/= 、%= 相邻运算符 阅读全文
posted @ 2022-05-11 12:18 Scenery_Shelley 阅读(113) 评论(0) 推荐(0)
摘要: System.out.printf(format, item1, item2, ..., items) 标识符 输出 举例 %b boolean ture false %c char ’a’ %d 十进制整数 200 %f float 45.460000 %e 标准科学记数法 4.556000e+0 阅读全文
posted @ 2022-05-11 12:14 Scenery_Shelley 阅读(43) 评论(0) 推荐(0)
摘要: boolean-expression ? expression1 : expression2 y = (x >0) ? 1 : -1; max = (num1 > num2) ? num1 : num2; System.out.println((num % 2 == 0) ? "num is eve 阅读全文
posted @ 2022-05-11 11:32 Scenery_Shelley 阅读(27) 评论(0) 推荐(0)
摘要: #两位数 import java.util.*; class Main { public static void main(String[] args){ //Generate a lottery int lottery = (int)(Math.random() * 100); //Prompt 阅读全文
posted @ 2022-05-11 11:07 Scenery_Shelley 阅读(199) 评论(0) 推荐(0)
摘要: 判断是否为闰年 非对话框实现 import java.util.*; class Main { public static void main(String[] args){ //Create a Scanner Scanner input = new Scanner(System.in); Sys 阅读全文
posted @ 2022-05-11 10:24 Scenery_Shelley 阅读(37) 评论(0) 推荐(0)