09 2021 档案
摘要:package com.kuang.array; // //Demo01 // public class ArrayDome01 { //变量的类型 变量的名字 = 变量的值; //数组类型 public static void main(String[] args) { int[] nums;//
阅读全文
摘要:package com.kuang.method; // //Demo01 // public class Demo01 { //main方法 public static void main(String[] args) { int sum = add(1, 2); System.out.print
阅读全文
摘要:package com.kuang.struct; public class TestDemo { public static void main(String[] args) { //打印三角形 五行 for (int i = 0; i <= 5; i++) { for (int j = 5; j
阅读全文
摘要:package com.kuang.struct; public class LablelDemo { public static void main(String[] args) { //打印100~150之间所有的质数 //质数是指在大于1的自然数中, 除了1和它本身以外不再有其他因数的自然数
阅读全文
摘要:package com.kuang.struct; public class BreakDemo { public static void main(String[] args) { int i = 0; while (i<100){ i++; System.out.println(i); if(i
阅读全文
摘要:package com.kuang.struct; // //Demo01 // public class ForDemo01 { public static void main(String[] args) { int a=1;//初始化条件 while (a<=100){//条件判断 Syste
阅读全文
摘要:package com.kuang.struct; // //Demo01 // public class DoWhileDemo01 { public static void main(String[] args) { int i = 0; int sum = 0; do { sum+=i; i+
阅读全文
摘要:package com.kuang.struct; // //Demo01 // public class WhileDemo01 { public static void main(String[] args) { //输出1~100 int i =0; while (i<100){ i++; S
阅读全文
摘要:package com.kuang.struct; // //Demo01 // public class SwitchDemo01 { public static void main(String[] args) { //case穿透 //switch 匹配一个具体的值 char grade =
阅读全文
摘要:package com.kuang.struct; import java.util.Scanner; // //Demo01 // public class IfDemo01 { public static void main(String[] args) { Scanner scanner =
阅读全文
摘要:package com.kuang.struct; public class ShunXunDemo { public static void main(String[] args) { System.out.println("hello1"); System.out.println("hello2
阅读全文
摘要:package com.kuang.scanner; import java.util.Scanner; // //Demo04 // public class Demo04 { public static void main(String[] args) { Scanner scanner = n
阅读全文
摘要:package com.kuang.scanner; import java.util.Scanner; // //Demo01 // public class Demo01 { public static void main(String[] args) { //创建一个扫描器对象,用于接受键盘数
阅读全文
摘要:package com.kuang.base; /** * @author Kuangshen * @version 1.0 * @since 1.8 */ public class Doc { String name; /** * @author Kuangshen * @param name *
阅读全文
摘要:package operator; // //Demo07 // public class Demo07 { public static void main(String[] args) { int a = 10; int b = 20; a+=b; //a = a+b a-=b; //a = a-
阅读全文
摘要:package operator; // //Demo05 // public class Demo05 { public static void main(String[] args) { // 与(and) 或(or) 非(取反) boolean a = true; boolean b = fa
阅读全文
摘要:package operator; public class Demo04 { public static void main(String[] args) { //++ -- 自增 自减 一元运算符 int a = 3; int b = a++; //先赋值再自增 int c = ++a; //先
阅读全文
摘要:package operator; // //Demo01 // public class Demo01 { public static void main(String[] args) { //二元运算符 //Ctrl + D: 复制当前行到下一行 int a =10; int b =20; in
阅读全文
摘要:public class Demo09 { //修饰符, 不存在先后顺序 static final double PI=3.14; public static void main(String[] args) { System.out.println(PI); } }
阅读全文
摘要:public class Demo08 { //类变量 static static double salary =2500; //属性:变量 //实例变量:从属于对象;如果不自行初始化,这个类型的默认值 0 0.0 u000 //布尔值:默认是false //除了基本类型,其余的默认都是null;
阅读全文
摘要:public class Demo07 { public static void main(String[] args) { //int a, b, c; //int a=1, b=2, c=3; String name = "Ahao"; char x = 'X'; double pi = 3.1
阅读全文
摘要:public class Demo06 { public static void main(String[] args) { //操作比较大的数的时候,注意溢出问题 //JDK7新特性,数字之间可以用下划线分割 int money = 10_0000_0000; int years = 20; in
阅读全文
摘要:public class Demo05 { public static void main(String[] args) { int i =128; double b= i; //内存溢出 //强制转换 (类型)变量名 高--低 //强制转换 (类型)变量名 低--高 System.out.prin
阅读全文
摘要:public class Demo03 { public static void main(String[] args) { //整数拓展 禁止 二进制0b 十进制 八进制0 十六进制0x int i1 =10; int i2 = 010; //八进制0 int i3 = 0x10; //十六进制0
阅读全文
摘要:```java package com.company; public class Main { public static void main(String[] args) { //八大基本数据类型 //整数 int num1 =10; //最常用 byte num2 = 20; short nu
阅读全文

浙公网安备 33010602011771号