随笔分类 - Java基础
摘要:1 public class Demo5 { 2 /** 3 * @author xxxx 4 * @version 1.0 5 * @since 1.8 6 */ 7 8 String name; 9 10 /** 11 * 12 * @param name 13 * @return 14 * @
阅读全文
摘要:1 public class Demo3 { 2 public static void main(String[] args) { 3 int a = 10; 4 int b = 20; 5 6 a+=b;//a = a + b 7 a-=b;//a = a - b 8 System.out.pri
阅读全文
摘要:1 public class Demo1 { 2 public static void main(String[] args) { 3 //与(and) 或(or) 非(取反) 4 boolean a = true; 5 boolean b = false; 6 7 System.out.print
阅读全文
摘要:1 public class Demo8 { 2 public static void main(String[] args) { 3 //++ -- 自增,自减 一元运算符 4 int a = 3; 5 int b = a++;//执行完这行代码后,先给b赋值,再自增 6 //a = a + 1;
阅读全文
摘要:1 public class Demo6 { 2 public static void main(String[] args) { 3 //二元运算符 4 //ctrl + D :复制当前行到下一行 5 int a = 10; 6 int b = 20; 7 int c = 25; 8 int d
阅读全文
摘要:1 public class demo4 { 2 //类变量 static 3 static double salary = 2500; 4 //属性:变量 5 //实例变量:从属于对象;如果不自行初始化,这个类型的默认值0 0.0 6 //布尔值:默认是false 7 //除了基本类型,其余的默认
阅读全文
摘要:1 public class demo3 { 2 public static void main(String[] args) { 3 //操作比较大的数的时候,注意溢出问题 4 //JDK7新特性,数字之间可以用下划线分割 5 int money = 10_0000_0000; 6 int yea
阅读全文
摘要:1 public class demo2 { 2 public static void main(String[] args) { 3 int i = 128; 4 double b = i; 5 6 //强制转换 (类型)变量名 高 >低 7 //自动转换 低 >高 8 System.out.pr
阅读全文
摘要:public class demo1 { public static void main(String[] args) { //整数拓展: 进制 二进制0b 十进制 八进制0 十六进制0x int i = 10; int i2 = 010;//八进制 int i3 = 0x10;//十六进制 0~9
阅读全文

浙公网安备 33010602011771号