随笔分类 -  Java基础编程

简单的程序设计
摘要: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 阅读(51) 评论(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 阅读(31) 评论(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 阅读(208) 评论(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 阅读(44) 评论(0) 推荐(0)
摘要:if else语句实现 import java.util.*; class Main { public static void main(String args[]){ //Create a Scanner Scanner input = new Scanner(System.in); //Prom 阅读全文
posted @ 2022-05-10 19:21 Scenery_Shelley 阅读(49) 评论(0) 推荐(0)
摘要:import java.util.*; class Main { public static void main(String args[]){ Scanner input = new Scanner(System.in); //prompt the user to enter weight in 阅读全文
posted @ 2022-05-10 18:01 Scenery_Shelley 阅读(61) 评论(0) 推荐(0)
摘要:单次计算 import java.util.*; class Main { public static void main(String []args) { //1. Generate two random single-digit integers int number1 = (int)(Math 阅读全文
posted @ 2022-05-10 17:44 Scenery_Shelley 阅读(160) 评论(0) 推荐(0)
摘要:Set1 二进制为:xxxx1 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 30 Set2 二进制为:xxx1x 2 3 6 7 10 11 14 15 18 19 22 23 26 27 30 31 Set3 二进制为:xx1xx 4 5 6 7 12 13 1 阅读全文
posted @ 2022-05-09 16:37 Scenery_Shelley 阅读(207) 评论(0) 推荐(0)
摘要:计算贷款支付额 月支付额 = 贷款总额月利率 /(1-1/(1+月利率)^(年数12)) import java.util.Scanner; class Main { public static void main(String[] args) { //Create a Scanner Scanne 阅读全文
posted @ 2022-05-08 15:44 Scenery_Shelley 阅读(91) 评论(0) 推荐(0)
摘要:import java.util.*; class Main { public static void main(String []args) { Scanner input = new Scanner(System.in); System.out.print("Enter the time zon 阅读全文
posted @ 2022-05-08 13:17 Scenery_Shelley 阅读(60) 评论(0) 推荐(0)