⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 classexample.java

📁 软通公司培训的课件和习题里面有答案。。。
💻 JAVA
字号:
package com.myclass.src;

public class ClassExample {
	int Num = 0;
	String[] a;
	static String schoolName = "软通动力 ";
	
	public ClassExample() {
	}
	
	public void addPerson(String temp) {
		int i;
		String[] b;
		if (a == null) {
			b = new String[1];
			b[0] = temp;
			a = b;
		} else {

			b = new String[a.length + 1];

			for (i = 0; i < a.length; i++)
				b[i] = a[i];
			b[i] = temp;
			a = b;
		}
		Num++;
	}

	public static void showName() {
		System.out.println(schoolName);
	}
	
	public void show() {
		for (int i = 0; i < a.length; i++)
			System.out.println(a[i]);
		System.out.println("Num=" + Num);
	}
	
	public static void main(String[] args) {
		ClassExample obj = new ClassExample();
		obj.addPerson("aaa");
		obj.addPerson("bbb");
		obj.addPerson("ccc");
		obj.show();
		ClassExample.showName();

	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -