上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 28 下一页
摘要: import java.util.regex.Matcher;import java.util.regex.Pattern; public class RegexMatches{ public static void main(String[] args){ //按指定模式在字符串查找 String 阅读全文
posted @ 2018-10-19 18:24 Alanf 阅读(170) 评论(0) 推荐(0) 编辑
摘要: Java 流(Stream)、文件(File)和IO 下面的程序示范了用read()方法从控制台不断读取字符直到用户输入"q"。 // 使用BufferedReader 在控制台读取字符 import java.io.* public class BRRead{public static void 阅读全文
posted @ 2018-10-19 18:24 Alanf 阅读(107) 评论(0) 推荐(0) 编辑
摘要: Java 方法 下面的方法包含2个参数num1和num2,它返回这两个参数的最大值。 /** 返回两个整型变量数据的较大值**/ public static int max(int num1,int num2){ int result; if(num1>num2) result = num1; el 阅读全文
posted @ 2018-10-19 18:24 Alanf 阅读(175) 评论(0) 推荐(0) 编辑
摘要: javac:Java编译器,Java程序的编译工具,用来将Java程序的源文件编译成字节码文件,也就是.class文件。java:Java解释器,解释和执行已经转换成字节码的Java应用程序。jdb:Java调试器,可以设置断点调试Java程序,还可以检查变量,逐行执行程序。javap:Java反汇 阅读全文
posted @ 2018-10-19 18:24 Alanf 阅读(710) 评论(0) 推荐(0) 编辑
摘要: try{ //程序代码}catch(ExceptionName e1){ //Catch 块} 下面的例子中声明有两个元素的一个数组,当代码试图访问数组的第三个元素的时候就会抛出一个异常。 //文件名: ExcepTest.javaimport java.io.*; public class Exc 阅读全文
posted @ 2018-10-19 18:24 Alanf 阅读(126) 评论(0) 推荐(0) 编辑
摘要: 下面是一个装箱与拆箱的例子: public class Test{ public static void main(String args[]){ Integer x = 5; // boxes int to an Integer object x = x+10; // unboxes the In 阅读全文
posted @ 2018-10-19 18:23 Alanf 阅读(166) 评论(0) 推荐(0) 编辑
摘要: char ch = 'a';// Unicode for uppercase Greek omega characterchar uniChar = '\u039A';//字符数组char[] charArray = {'a','b','c','d','e'}; // Here following 阅读全文
posted @ 2018-10-19 18:23 Alanf 阅读(132) 评论(0) 推荐(0) 编辑
摘要: double[] myList //首选方法 double myList[] //效果相同,但不是首选方法 该实例完整地展示了如何创建、初始化和操纵数组: public class TestArray{ public static void main(String[] args){ double[] 阅读全文
posted @ 2018-10-19 18:23 Alanf 阅读(135) 评论(0) 推荐(0) 编辑
摘要: import java.util.Date;public class DateDemo{ public static void main(String[] args){ //初始化Date对象 Date date = new Date(); //使用toString() 函数显示日期时间 Syste 阅读全文
posted @ 2018-10-19 18:23 Alanf 阅读(230) 评论(0) 推荐(0) 编辑
摘要: public class StringDemo{ public static void main(String args[]){ char[] helloArray = {'h','e','l','l','o'}; String helloString = new String(helloArray 阅读全文
posted @ 2018-10-19 18:23 Alanf 阅读(120) 评论(0) 推荐(0) 编辑
上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 28 下一页