摘要: public class SingleTonDemo { public static void main(String[] args) { SingleTon.getSingle(); SingleTon.getSingle(); } } class SingleTon{//创建单例类/由类的本身创建对象 //private static SingleTon singleTo... 阅读全文
posted @ 2018-02-04 20:05 biubiubiuo 阅读(114) 评论(0) 推荐(0)
摘要: public class constructor { public static void main(String[] args) { // TODO Auto-generated method stub Person p = new Person("张三",25,"山东");//构造函数的作用就是强制进行初始化,在进行赋值的时候如果有遗漏立即报错 //如:Person p... 阅读全文
posted @ 2018-02-04 16:53 biubiubiuo 阅读(139) 评论(0) 推荐(0)
摘要: public class teacherDemo { public static void main(String []args) { String name = "张三"; int age = 25; teacher tea = new teacher(); tea.setName(name); tea.setAge(age); System.out.println... 阅读全文
posted @ 2018-02-04 16:21 biubiubiuo 阅读(120) 评论(0) 推荐(0)
摘要: public class EmployeeDemo { //方法一: public int search(String str,String strRes) {//查找字符串里与指定字符串相同的个数 int n=0;//计数器 // for(int i = 0;i<str.length();i++) { // // } while(str.indexOf(strRes)!=... 阅读全文
posted @ 2018-02-04 16:19 biubiubiuo 阅读(13490) 评论(1) 推荐(0)