打印购物小票
摘要:package 打印购物小票;public class T1{ public static void main(String[] args) { int tprice=245; int xieprice=570; int paiprice=320; double zong=1104.0; int m
阅读全文
posted @
2020-10-29 12:57
张德明
阅读(292)
推荐(0)
多维数组
摘要:package 多维数组;public class Example { public static void main(String[] args) { int [][] arr =new int [3][]; //定义一个长度为3的二维数组 arr[0]=new int[] {11,12}; //
阅读全文
posted @
2020-10-22 11:17
张德明
阅读(103)
推荐(0)
猜数字游戏
摘要:package 猜数字游戏;import java.util.Random;import java.util.Scanner;public class GuessNumber { public static void main(String[] args) { int randomNumber=ne
阅读全文
posted @
2020-10-22 11:14
张德明
阅读(124)
推荐(0)
数组常见的操作
摘要:1.package 数组的常见操作;public class Example { public static void main(String[] args) { int [] arr= {1,2,3,4,5}; //定义数组 for (int i=0;i<arr.length;i++) { Sys
阅读全文
posted @
2020-10-22 11:09
张德明
阅读(212)
推荐(0)
数组定义
摘要:1.package 数组定义;public class Example { public static void main(String[] args) { int [] arr; //声明变量 arr=new int[3]; //创建数组对象 System.out.println("arr[0]=
阅读全文
posted @
2020-10-20 10:53
张德明
阅读(143)
推荐(0)
随机点名
摘要:package 随机点名器;import java.util.Random;import java.util.Scanner;public class CallName { public static void addStudentName(String[] stduents) { //*存储全班同
阅读全文
posted @
2020-10-20 10:47
张德明
阅读(475)
推荐(0)
switch语句
摘要:package if条件语句;public class Example03 { public static void main(String[] args) { int week =5; switch (week) { case 1: System.out.println("星期一"); break
阅读全文
posted @
2020-10-14 16:30
张德明
阅读(93)
推荐(0)
if.....else if.....else语句
摘要:package if条件语句;public class Example02 { public static void main(String[] args) { int grade=75; //定义学生成绩 if(grade>80) { //满足条件grade>80 System.out.print
阅读全文
posted @
2020-10-14 16:24
张德明
阅读(218)
推荐(0)
if.....else语句
摘要:package if条件语句;public class Example01 { private static int unm; public static void main(String[] args) { unm = 19; if(19 % 2== 0 ){ //条件,num被2整除 Syste
阅读全文
posted @
2020-10-14 16:22
张德明
阅读(96)
推荐(0)
if语句(1)
摘要:package if条件语句;public class Example { public static void main(String[] args){ int x=5; if(x<10) { x++; } System.out.println("x="+x); }} 结果:
阅读全文
posted @
2020-10-14 16:19
张德明
阅读(139)
推荐(0)
商城库存清单程序设计
摘要:package 商城库存清单程序设计;public class StoreList { public static void main(String[] args) { String macBrand="MacBookAir"; //苹果笔记本电脑 double macSize=13.3; doub
阅读全文
posted @
2020-10-13 09:23
张德明
阅读(685)
推荐(0)
赋值运算符
摘要:1.package 赋值运算符;public class Example01 { public static void main(String[] args) { short s=3; int i=5; s+=i; System.out.println("s="+s); }} 结果: 2.packa
阅读全文
posted @
2020-10-13 09:15
张德明
阅读(77)
推荐(0)
变量的类型转换
摘要:1.package 变量的类型转换; public class Example01 { public static void main(String [] args) { int unm=4; byte b=(byte) 4; System.out.println(b); } } 结果: 2.pac
阅读全文
posted @
2020-10-06 20:16
张德明
阅读(293)
推荐(0)