摘要: package com.oop;import com.oop.demo05.Person;import com.oop.demo05.Student;public class Application { public static void main(String[] args) { Student 阅读全文
posted @ 2021-06-11 13:07 Leoyuan 阅读(44) 评论(0) 推荐(0) 编辑
摘要: package com.oop;import com.oop.demo05.Student;public class Application { public static void main(String[] args) { Student student = new Student(); stu 阅读全文
posted @ 2021-06-11 07:38 Leoyuan 阅读(45) 评论(0) 推荐(0) 编辑
摘要: package com.oop.demo04;//类 private:私有public class Student { //属性私有 private String name; //名字 private int id;//学号 private char sex;//性别 private int age 阅读全文
posted @ 2021-06-11 07:10 Leoyuan 阅读(48) 评论(0) 推荐(0) 编辑
摘要: package com.oop;import com.oop.demo03.Pet;public class Application { public static void main(String[] args) { /* 1. 类与对象 类是一个模板:抽象,对象是一个具体的实例 2. 方法 定义 阅读全文
posted @ 2021-06-10 23:23 Leoyuan 阅读(46) 评论(0) 推荐(0) 编辑
摘要: package com.oop.demo03;public class Pet { public String name; public int age; //无构造参数 public void shout(){ System.out.println("叫了一声"); }}/* public sta 阅读全文
posted @ 2021-06-10 22:31 Leoyuan 阅读(33) 评论(0) 推荐(0) 编辑
摘要: package com.oop.demo02;//java-->classpublic class Person { //一个类即使什么都不写,它也会存在一个方法 //显示的定义构造器 String name; int age; //实例化初始化 //1. 使用new关键字,本质在调用构造器 //2 阅读全文
posted @ 2021-06-10 21:48 Leoyuan 阅读(42) 评论(0) 推荐(0) 编辑
摘要: package com.oop.demo02;//一个项目应该只有一个main方法public class Application { public static void main(String[] args) { //类:抽象的,实例化 //类实例化后会返回一个自己的对象! //student对 阅读全文
posted @ 2021-06-10 19:52 Leoyuan 阅读(39) 评论(0) 推荐(0) 编辑
摘要: package com.oop.demo01;public class Demo02 { public static void main(String[] args) { //实例化这个类 new //对象类型 对象名 = 对象值; Student student = new Student(); 阅读全文
posted @ 2021-06-10 17:50 Leoyuan 阅读(44) 评论(0) 推荐(0) 编辑
摘要: package com.oop.demo01;import java.io.IOException;//Demo01 类public class Demo01 { //main 方法 public static void main(String[] args) { } /* 修饰符 返回值类型 方法 阅读全文
posted @ 2021-06-10 17:17 Leoyuan 阅读(34) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2021-06-10 09:03 Leoyuan 阅读(24) 评论(0) 推荐(0) 编辑