摘要: 面向过程思想 ◆步骤清晰简单,第一步做什么,第二步做什么.... ◆面对过程适合处理一些较为简单的问题 面向对象思想 ◆物以类聚,分类的思维模式,思考问题首先会解决问题需要哪些分类,然后对这些分类进 行单独思考。最后,才对某个分类下的细节进行面向过程的思索。 ◆面向对象适合处理复杂的问题,适合处理需 阅读全文
posted @ 2023-02-07 21:40 佩德罗帕斯卡 阅读(15) 评论(0) 推荐(0)
摘要: 创建与初始化对象 ◆使用new关键字创建的时候,除了分配内存空间之外,还会给创建好的对象进行默认的初始化 以及对类中构造器的调用。 ◆类中的构造器也称为构造方法,是在进行创建对象的时候必须要调用的。并且构造器有以下俩 个特点: 必须和类的名字相同 必须没有返回类型,也不能写void 构造器必须要掌握 阅读全文
posted @ 2023-02-07 21:40 佩德罗帕斯卡 阅读(22) 评论(0) 推荐(0)
摘要: 属性和方法组成类 package com.oop; //属性和方法组成类 public class Student { //属性 String name; int age; //方法 public void study(){ System.out.println(this.name+"在学习"); 阅读全文
posted @ 2023-02-07 21:40 佩德罗帕斯卡 阅读(15) 评论(0) 推荐(0)
摘要: 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 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 阅读全文
posted @ 2023-02-07 14:32 佩德罗帕斯卡 阅读(21) 评论(0) 推荐(0)
摘要: Arrays.sort() //Arrays类sort方法,作用:数组升序 Arrays.toString() //Arrays类toString方法,作用:数组内容的字符串表示形式 package com.wang.array; import java.util.Arrays; public cl 阅读全文
posted @ 2023-02-07 13:21 佩德罗帕斯卡 阅读(23) 评论(0) 推荐(0)
摘要: package com.wang.array; import java.util.Arrays; public class Demo07 { public static void main(String[] args) { int[] x = {5,92,65,48,24,22,67,65,84,1 阅读全文
posted @ 2023-02-06 22:02 佩德罗帕斯卡 阅读(16) 评论(0) 推荐(0)
摘要: public class Demo03 { public static void main(String[] args) { int [] arrays = {1,2,3,4,5,99}; //打印全部数组元素 for (int i = 0; i < arrays.length; i++) { Sy 阅读全文
posted @ 2023-02-06 22:01 佩德罗帕斯卡 阅读(18) 评论(0) 推荐(0)
摘要: public class Demo01 { public static void main(String[] args) { int[] a; //声明一个数组,名字a a = new int[10]; //创建一个数组,10个长度 int[] b = new int[10]; //直接创建数组方法 阅读全文
posted @ 2023-02-06 21:58 佩德罗帕斯卡 阅读(31) 评论(0) 推荐(0)
摘要: package com.wang.mothod; import java.util.Scanner; public class Demo01 { public static void main(String[] args) { Scanner scanner = new Scanner(System 阅读全文
posted @ 2023-02-06 13:00 佩德罗帕斯卡 阅读(63) 评论(0) 推荐(0)
摘要: public class Demo06 { public static void main(String[] args) { System.out.println(f(5)); } //定义一个方法 阶乘 public static int f(int n){ if(n==1){ return 1; 阅读全文
posted @ 2023-02-06 12:58 佩德罗帕斯卡 阅读(9) 评论(0) 推荐(0)