摘要: 常用字体 Courier New1.String[ ] a=new String [ ] {"1","s","d" }; //注意后面的中括号不要写元素个数3,否则错2.String[ ] b=new String[3];for(int i=0;i<b.length;i++){ System.out 阅读全文
posted @ 2020-05-26 21:16 向阳xy 阅读(107) 评论(0) 推荐(0)
摘要: 1.静态方式 String str="this" 2.动态方式 String str=new String("this") 区别: 静态方式创建字符串,在堆内存的缓冲池中只会产生一个字符串对象,使用该方式产生同样的一个字符串时,堆内存不在开辟空间,而是两个引用变量指向同一个字符串对象 动态创建的字符 阅读全文
posted @ 2020-05-26 11:30 向阳xy 阅读(158) 评论(0) 推荐(0)
摘要: package day1; public class IntegerDemo { public static void main(String[] args) { //String转int,类名.方法 String s="123"; Integer a= Integer.parseInt(s); S 阅读全文
posted @ 2020-05-26 10:35 向阳xy 阅读(187) 评论(0) 推荐(0)
摘要: 只能有一个实例称为单例模式 1.私有化构造器 2.定义一个静态方法用于获取单例对象,返回值是类的类型 3.在类中提供一个私有化的singleton类型的类属性 4.实现getInstance类方法 class Singleton {//懒汉模式,用到的时候才创建对象 private static S 阅读全文
posted @ 2020-05-26 10:10 向阳xy 阅读(132) 评论(0) 推荐(0)
摘要: public class B { public static void test() { System.out.println("B==test"); } } public class A extends B{ public static void test() { System.out.print 阅读全文
posted @ 2020-05-23 09:44 向阳xy 阅读(209) 评论(0) 推荐(1)