i 绝望

依然

Miss Lang
上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 31 下一页
  2013年12月23日
摘要: 总结;对于length()属性,还不是很熟悉。不会用它。package com.s.x;//随机产生10个随机数,并且显示出最大值,最小值public class Love { public static void main(String[] args) { int a[] = new int[10]; int max, min; for (int i = 0; i a[i]) min = a[i]; } System.out.println("最大值" + max); System.out.println("最小值" + min); }} 阅读全文
posted @ 2013-12-23 21:53 juewang 阅读(11454) 评论(0) 推荐(0) 编辑
  2013年12月22日
摘要: 总结:主要是方法的理解老师曾经说过final 和fianlly的区别我自己的理解就是如果一个类的前面定义了final,那么它就不能被继承,派生子类,对于方法,那么方法就不能改变,变量前面也是必赋初值初始化而finally是异常处理的最末,适用于是释放资源,关闭文件,等等。与finally与fianl一点关系都没有无论try-catch里的语句是否异常,fianlly语句块内代码都会执行package com.s.x;public class fun { public static void main(String[] args) { String s = "34548764" 阅读全文
posted @ 2013-12-22 23:31 juewang 阅读(248) 评论(0) 推荐(0) 编辑
摘要: 总结:主要是方法不同了。是compareTo()方法比较字符串大小package com.s.x;import java.util.Arrays;public class Jay { public static void main(String[] args) { // 对String 数组进行排序 String s[] = { "fda", "wad", "qsa", "ass", "gad" }; for (int i = 0; i 0) {// 这里注意字符串间比较大小的方法。compte 阅读全文
posted @ 2013-12-22 22:28 juewang 阅读(857) 评论(0) 推荐(0) 编辑
摘要: 总结:是自己不听讲吧,不懂啊感觉父类的方法,子类可以重载,只要参数个数不同,重载与返回值没有关系重写绝对是可以的。但答案是只能重写啊package com.s.x;public class Tear { public int addValue(int a, int b) { int s; s = a + b; return s; }}// 类与类之间是重写,就是方法名,参数个数类型都相同,除了方法体。决不能出现重载吗?为什么呢?class Chile extends Tear { // 这里使用方法重载是否可以 /* * (public int addValue(int a){//这是... 阅读全文
posted @ 2013-12-22 21:44 juewang 阅读(334) 评论(0) 推荐(0) 编辑
摘要: package com.s.x;//indexOf()方法从字符起始处的第一个位子开始的位置//substringpublic class Wang { public static void main(String[] args) { String s = "This is my original srting "; String s2 = s.substring(2);// is my origianl string // 或者 // s = s.substring(4); System.out.println(s2); if (s.indexOf('y' 阅读全文
posted @ 2013-12-22 21:09 juewang 阅读(2213) 评论(0) 推荐(0) 编辑
摘要: 总结:方法是indedOf()方法。this is my sister //indexOf()方法是indexOf('m')==7 .那么就是字符m第一次出现的位置是顺数第7个,就会正常显示‘true’package com.s.x;//indexOf()方法从字符起始处的第一个位子开始的位置//substringpublic class Wang { public static void main(String[] args) { String s = "i love him forever"; if (s.indexOf('o') == 阅读全文
posted @ 2013-12-22 20:36 juewang 阅读(6155) 评论(0) 推荐(0) 编辑
摘要: 总结:按照索引substring(2,5);意思是从字符串的索引为2开始(包括)到第6个字符(不包括)的位置的截取部分package com.s.x;//substringpublic class Wang { public static void main(String[] args) { String s = "This is my oraginal string"; String s1 = s.substring(2);// substring ()方法是从索引为2开始截取这个索引以后的所有字符串 System.out.println(s1); String s2 = 阅读全文
posted @ 2013-12-22 20:30 juewang 阅读(1177) 评论(0) 推荐(0) 编辑
摘要: package com.s.x;public class Wang { public static void main(String[] args) { if ("woaini".indexOf('m') == 3) {// indexOf()方法是查找特定字符或字符串在当前字符串中的起始位置 System.out.println("true");// 下标注意从什么开始如果不存在就返回-1 } else { System.out.println("Wrong answer"); } }} 总结:方法 是indexOf 阅读全文
posted @ 2013-12-22 20:18 juewang 阅读(2753) 评论(0) 推荐(0) 编辑
  2013年12月21日
摘要: 总结:主要是方法的调用不能错,比如浮点型,整型,字节型,so.onint ====hasNextInt()float--------hasNextfloat()short ====hasNextShort()package com.a.b;import java.util.Scanner;public class Ruo { public static void main(String[] args) { int a = 0; // 创建Scanner对象c,其内容来自InputStream类 Scanner c = new Scanner(System.in); System.out... 阅读全文
posted @ 2013-12-21 23:13 juewang 阅读(525) 评论(0) 推荐(0) 编辑
摘要: package com.a.b;import java.io.*;public class Yu { public static void main(String[] args) throws IOException { // InputStream is=new InputStream(System.in); InputStreamReader isr = new InputStreamReader(System.in); BufferedReader st = new BufferedReader(isr); // 读取并输出字符串 System.out.println("请输入 阅读全文
posted @ 2013-12-21 22:47 juewang 阅读(526) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 31 下一页

绝望依然

Miss Lang