- 博客(13)
- 收藏
- 关注
原创 2021-03-14用户交互Scanner
关键词 new scanner package Tang; import java.util.Scanner; public class Test { public static void main(String[] args) { //创造一个扫描器对象,用于接收键盘数据 Scanner scanner = new Scanner(System.in); //判断用户有无输入字符串 if (scanner.hasNextLine()==true){ //使用next的方式来接收 String str .
2021-03-14 21:42:42
77
原创 2021-03-05幂运算与逻辑运算符
public class Test { public static void main(String[] args) { //快捷键alt+空格 double pow = Math.pow(2,3); System.out.println(pow); boolean a=true; boolean b=false; System.out.println(a&&b);//&&和 System.out.println(a||b);//||或 System.out.println(
2021-03-06 14:20:46
123
原创 2021-02-26自增自减与幂运算
public class Test2 { public static void main(String[] args) { int a = 1; //a++表示先给b赋值,再给a增值,此时a=2 int b = a++; //++a表示先给a增值,再给c赋值,此时a=3 int c = ++a; System.out.println(a); System.out.println(b); System.out.println(c); //幂
2021-02-26 15:53:25
63
原创 2021-02-25变量与常量
public class Test { //实例变量,从属于类Test int age; //类变量,从属于类Test static int b = 2; public static void main(String[] args) { //局部变量 int a = 1; System.out.println(a); //变量类型 变量名字=new Test Test test = new Test(); System.out.println(test.ag
2021-02-25 17:34:25
58
原创 2021-02-23强行转变类型
public class test { public static void main(String[] args) { byte a = 100; int b = a + 1; System.out.println(b); System.out.println("------------------------------"); //强转测试 int c = 127+1; byte d = (byte)c; System.out.println(d); System.out.println("------
2021-02-23 15:33:11
56
原创 2021-02-21基本数据类型近一步学习
public class Hot { public static void main(String[] args) { /*进制 二进制0B/0b 八进制0 十六进制0x */ int a = 1; int c = 010; int d = 0x10; System.out.println(a); System.out.println©; System.out.println(d); //浮点数拓展 float f = 0.1f; double g =1.0/10; System.out.println(f
2021-02-21 23:48:41
67
原创 2021-02-20 八大基本数据类型,所有变量必须先定义后才能使用!
public class Hot { public static void main(String[] args) { //整数 byte num1 = 1; short num2 = 2; int num3 = 3;//常用 long num4 = 4L; //小数 float num5 = 5.1F; double num6 = 6.213; //字符 //单字符 char num7 = ‘唐’; //多字符 String num8 = “唐辉”; /*布尔值 boolean flag = true;
2021-02-20 20:21:59
193
原创 2021-02-15 Hello.world
Hello.world public class Hello{ public static void main(String[] args){ System.out.print(“Hello,World!”); } }
2021-02-15 21:29:30
64
原创 2021-02-10 CMD使用
盘符切换 C: 查看目录下文件 dir 切换目录 cd 清屏 cls 退出 exit 查看ip ping 网址 文件操作 创建md 进入cd 退回上级cd… 创建文本cd> 删除del 移除目录rd(前提无文件)
2021-02-10 16:28:58
123
原创 2021-02-09 Markdown使用
标题 二级标题 字体 hello,worlod helloworld hello,world hello,world 引用 千里之堤溃于蚁穴 分割线 图片 [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-XSFTSwzl-1612854381799)(C:\Users\潘多拉之盒\Pictures\Saved Pictures\OIP.jpg)] [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-hZfsfhn0-1612854381802)(
2021-02-09 15:07:29
90
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人