大数据day1 - Wayne53777/Java- GitHub Wiki
package cn.zwz.day01; /**
- 变量的使用
*/ public class VerDemo { public static void main(String[] args) { int age; age=18; byte a; a=10; short b; b=512; long c; c=1234L; float n; n=1.11F; double x; x=1.333; char e; e='a'; String d = "zhangwenzhe"; System.out.println(age); System.out.println(a); System.out.println(b); System.out.println(c); System.out.println(n); System.out.println(x); System.out.println(e); System.out.println(d); System.out.println(age - a); System.out.println(age + a); System.out.println(age * a); System.out.println(age / a); }
} package cn.zwz.day01;
import java.util.Scanner;
public class ScannerDemo { public static void main (String[] args) { //1.导包ctrl+shift+o //2.创建键盘输入对象 Scanner sc =new Scanner(System.in); System.out.println("请输入a: ");//3.接收数据 int a = sc.nextInt(); System.out.println("请输入b: ");//3.接收数据 int b = sc.nextInt(); System.out.println("两者之和为:"+ (a + b)); System.out.println("两者之积为:"+ (a * b)); System.out.println("两者之差为:"+ (a - b)); System.out.println("两者之商为:"+ (a / b)); System.out.println(a + " "+ b); sc.close();
}
} package cn.zwz.day01;
public class OperatorDemo02 { public static void main(String[] args) { int x=1500; int y= 1500; char p = 'A'+32; System.out.println(x % y);//取余 System.out.println(x % -y);//取余 System.out.println(-x % -y);//取余 System.out.println(-x % y);//取余 System.out.println(x / y); char c='0'; System.out.println(c); System.out.println(x + c); System.out.println("love" + (x + y)); System.out.println(p); }
}