摘要:
String str = "helloworld"; char data[] = str.toCharArray(); for(int x = 0 ; x< data.length ;x++) { data[x] -= 32 ; // 小写变大写 System.out.print(data[x] + 阅读全文
摘要:
字符串常量是String类的匿名对象 String str = "hello"; System.out.println(str.equals("hello")); System.out.println("hello".equals("str")); 阅读全文
摘要:
String类的两种类的实例化模式,可以直接使用赋值实例化对象 第一种:String str = "hello"; // 直接赋值 String str1 = "hello"; String str1 = "hello"; String str1 = "hello"; System.out.prin 阅读全文
摘要:
基本数据类型的数组,对象也可以定义为数组,对象数组往往以引用数组的格式存在 对象数组动态初始化:类名称,对象数组名称[] = new [长度] 对象数组静态初始化:类名称,对象数组名称[] = new [] {实例化对象} 对象数组动态初始化 动态初始化之后对象数组中的每一个元素都是其对应数据类型的 阅读全文
摘要:
int data[] = new int [] {1,2,3,4,5,6,7,8}; int search = 7; public static int index(int arr[],int key) { for(int x = 0 ;x<arr.length;x++) { if(arr[x] = 阅读全文