![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Java#学习
古二蛋
这个作者很懒,什么都没留下…
展开
-
数组的基础练习
数组的创建方式int[] nums;int nums1[];int[] nums2 = new int[5];int[] nums4 = new int[]{5,4,6,3,2,};课后练习1、ABCD(条件:AB永远不在一起,CD永远在一起)有多少种组合?打印出所有组合。static int one(){ char[] letter = {'A','D','C','B'}; ...原创 2019-10-18 20:19:49 · 176 阅读 · 0 评论 -
子类与父类的调用(day10)
关键字 extends 继承使用方法:public class 子类名称 extends 父类名称{}关键字 super 调用父类super.父类方法super.父类属性 //分别创建子类对象去调用父类方法 SmallDog smalldog = new SmallDog(); System.out.println(smalldog.age + smalldog.dogName...原创 2019-10-25 08:56:15 · 150 阅读 · 0 评论 -
基于对象的数组(day09)
一个对象类public class Study { String name;}基于对象的数组的赋值与遍历 Study[] stu; stu = new Study[6]; String[] name = {"111","222","333","444","555","666"}; //利用数组和for循环给对象数组赋值 for(int x = 0; x<stu....原创 2019-10-24 08:27:06 · 128 阅读 · 0 评论 -
面对对象第一节-(day07)
主函数代码(同包调用)public class Main_Person { public static void main(String[] args) { Lianxi02 Two = new Lianxi02("张三",4200,5); System.out.println("实发工资: "+Two.salary()); }}实现代码public class Lianxi...原创 2019-10-21 20:19:58 · 129 阅读 · 0 评论 -
关于++a==a++运算顺序的问题(day05)
符号在前先++再判断,,,符号在后判断 后++public class Study{ public static void main(String[] args) { int a=1,b=1; if(++a==b++)//++a 符号在前先++再判断,,,符号在后判断 后++ System.out.println("a="+a); else System.out....原创 2019-10-18 09:10:17 · 576 阅读 · 0 评论 -
三元运算符和&&、|(day03)
三元运算符题目:大于90输出A,60-90输出B,小于60输出C。char str=(n>90?'A':(n>60?'B':'C'));逻辑运算符 &&、&当使用&,算式两边的表达式都要运行,&&当左边为false 后面的表达式就不运行了,逻辑运算符 ||、|当使用|,算式两边的表达式都要运行,||当左边为true 后面...原创 2019-10-17 11:04:32 · 939 阅读 · 0 评论 -
Java学习第一天(day01)
自动类型转换只能由小到大byte、short、char->int->long->float->double整数默认为int,小数默认为double,进行计算前java都会自动默认类型**by:第1day-2019年10月14日...原创 2019-10-17 10:40:05 · 135 阅读 · 0 评论 -
取余、取商的使用
1.输入一整数作为秒数,在控制台按小时,分钟,秒的格式输出( 如输入600,页面显示:0小时10分0秒 ) System.out.println("请输入一个整数"); Scanner scan = new Scanner(System.in); int num = scan.nextInt(); System.out.print(" 时间 为: " + num /...原创 2019-10-17 10:55:38 · 1369 阅读 · 1 评论