摘要: // 继承关键字extends,一个子类只能对应一个父类,这就是继承的单一性 class Student2 extends Personer{ String name; // 没赋值是null public static int age = 18; public void study(){ Syst 阅读全文
posted @ 2021-02-15 10:44 火鸡的呐喊 阅读(18) 评论(0) 推荐(0) 编辑
摘要: public class OOP { public static void main(String[] args) { // 引用传递 和 值传递 与 js复杂类型和基本类型一样因为地址的原因改不改变传递的本身值 // 类与对象的关系: 模板和实例的关系 Student student = new 阅读全文
posted @ 2021-02-14 15:07 火鸡的呐喊 阅读(28) 评论(0) 推荐(0) 编辑
摘要: public class Sparse { public static void main(String[] args) { // 稀疏数组的目的是为了减少无意义的数组元素 /*0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 阅读全文
posted @ 2021-02-13 23:42 火鸡的呐喊 阅读(55) 评论(0) 推荐(0) 编辑
摘要: public class ArrayClass { public static void main(String[] args) { int[] arr = {1,2,3,4,5}; // 打印数组 System.out.println(Arrays.toString(arr)); // 填充数组( 阅读全文
posted @ 2021-02-13 21:44 火鸡的呐喊 阅读(29) 评论(0) 推荐(0) 编辑
摘要: public class Arr { public static void main(String[] args) { // 定义一个数组 int[] arr = new int[5]; for(int i = 0; i < arr.length; i++){ arr[i] = 12; } // 打 阅读全文
posted @ 2021-02-12 18:44 火鸡的呐喊 阅读(82) 评论(0) 推荐(0) 编辑
摘要: public class Demo2 { // 可变参数的传参 public static void main(String[] args) { Demo2 demo2 = new Demo2(); demo2.printString("l","o","v","e"); // l o v } pub 阅读全文
posted @ 2021-02-12 12:45 火鸡的呐喊 阅读(39) 评论(0) 推荐(0) 编辑
摘要: // 命令行java命令执行的时候这里会报错的,所以需要去com的上一级的目录去java com.mixi.wc.Demo 这样去执行,命令如下 // java com.moxi.wc.Demo aa bb package com.moxi.wc; /** * @author Mr.Wang * @ 阅读全文
posted @ 2021-02-12 12:31 火鸡的呐喊 阅读(91) 评论(0) 推荐(0) 编辑
摘要: public class ScannerDemo { public static void main(String[] args) { Scanner s = new Scanner(System.in); System.out.println("请输入您的金钱"); // s.hasNext() 阅读全文
posted @ 2021-02-11 20:22 火鸡的呐喊 阅读(57) 评论(0) 推荐(0) 编辑
摘要: public class demo3 { public static void main(String[] args) { // 增强for循环,也叫forEach遍历 <=> 数组或者集合对象的语法糖 int[] arr = {1,2,3,4,5,6}; // 最笨的方法 for(int i = 阅读全文
posted @ 2021-02-11 19:40 火鸡的呐喊 阅读(33) 评论(0) 推荐(0) 编辑
摘要: public class typeChange { public static void main(String[] args) { int a = 1_000_000_000; // jdk7 支持用_去分割数字 int b = 1000; long num = a * (long)b; // 此 阅读全文
posted @ 2021-02-10 13:13 火鸡的呐喊 阅读(30) 评论(0) 推荐(0) 编辑