随笔分类 -  java基础

摘要:1 import java.util.*; 2 public class hello 3 { 4 public static void main(String[] args) 5 { 6 System.out.println("请输入\n包括:字母、数字、空格、及特殊符号"); 7 Scanner s=new Scanner(Sys... 阅读全文
posted @ 2016-05-16 10:55 明天会更好!!!! 阅读(276) 评论(0) 推荐(0)
摘要:1 import java.util.*; 2 public class helloworld 3 { 4 public static void main(String[] args) 5 { 6 Scanner s=new Scanner(System.in); 7 8 int sz[]=new int[3];... 阅读全文
posted @ 2016-05-15 22:18 明天会更好!!!! 阅读(455) 评论(0) 推荐(0)
摘要:1 public class nihao 2 { 3 public static void main(String[] args) 4 { 5 int n=0; 6 int a=0;int b=0;int c=0; 7 for(int i=1;i<=4;i++) 8 { 9 ... 阅读全文
posted @ 2016-05-15 21:18 明天会更好!!!! 阅读(191) 评论(0) 推荐(0)
摘要:1 public class nihao 2 { 3 public static void main(String[] args) 4 { 5 double a=0;double b=100; 6 for(int i=0;i<=10;i++) 7 { 8 System.out.println... 阅读全文
posted @ 2016-05-14 22:19 明天会更好!!!! 阅读(132) 评论(0) 推荐(0)
摘要:1 public class hello 2 { 3 public static void main(String[] args) 4 { 5 6 Integer i=new Integer("12345");//new转换 7 Integer.parseInt("12345");//parse转换 8 ... 阅读全文
posted @ 2016-05-14 22:07 明天会更好!!!! 阅读(120) 评论(0) 推荐(0)
摘要:1 import java.util.*; 2 public class nihao 3 { 4 public static void main(String[] args) 5 { 6 Scanner n=new Scanner(System.in); 7 System.out.println("请输入学生的成绩"); 8 ... 阅读全文
posted @ 2016-05-14 11:35 明天会更好!!!! 阅读(143) 评论(0) 推荐(0)
摘要:1 public class hello 2 { 3 public static void main(String[] args) 4 { 5 //大小写转换 6 String a="abcd"; 7 System.out.println(a.toUpperCase());//大写转小写 8 Sys... 阅读全文
posted @ 2016-05-14 11:06 明天会更好!!!! 阅读(195) 评论(0) 推荐(0)
摘要:值类型使用的是栈内存 值类型直接保存在栈内存中 引用类型使用的是堆内存 引用类型保存在堆内存中,在栈内存中保存保存的是指向地址 【定义】 引用类型表示你操作的数据是同一个,也就是说当你传一个参数给另一个方法时,你在另一个方法中改变这个变量的值,那么调用这个方法是传入的变量的值也将改变.值类型表示复制 阅读全文
posted @ 2016-05-13 23:27 明天会更好!!!! 阅读(145) 评论(0) 推荐(0)
摘要:1 public class nihao 2 { 3 public static void main(String[] args) 4 { 5 6 String str="abcdefbc"; 7 System.out.println(str.replace("bc", "?"));//把字符串中的 所有bc替换成... 阅读全文
posted @ 2016-05-13 23:04 明天会更好!!!! 阅读(106) 评论(0) 推荐(0)
摘要:1 import java.util.*; 2 public class nihao 3 { 4 public static void main(String[] args) 5 { 6 7 for(int i=1;i<=5;i++) 8 { 9 Random n=new Random(... 阅读全文
posted @ 2016-05-12 22:50 明天会更好!!!! 阅读(168) 评论(0) 推荐(0)
摘要:1 public class helloworld 2 { 3 public static void main(String[] args) 4 { 5 //截取 6 String str="abcdef"; 7 System.out.println(str.substring(2,5));//从索引2开始,截取到索... 阅读全文
posted @ 2016-05-12 15:50 明天会更好!!!! 阅读(213) 评论(0) 推荐(0)
摘要:1 public class helloworld 2 { 3 public static void main(String[] args) 4 { 5 //字符串的两种定义方式 第一种 String a="abcdef"; 第二种String c=new String("abcdef"); 6 String a="... 阅读全文
posted @ 2016-05-12 15:45 明天会更好!!!! 阅读(110) 评论(0) 推荐(0)
摘要:1 import java.util.*;//从包中调用随机生成器 2 public class helloworld 3 { 4 public static void main(String[] args) 5 { 6 Random a=new Random();//定义一个随机生成器 7 a.nextInt(100);//随机生... 阅读全文
posted @ 2016-05-11 15:53 明天会更好!!!! 阅读(102) 评论(0) 推荐(0)
摘要:1 public class helloworld 2 { 3 public static void main(String[] args) 4 { 5 double a=4.561234; 6 System.out.println(Math.round(a));//四舍五入 7 System.out.println... 阅读全文
posted @ 2016-05-11 15:49 明天会更好!!!! 阅读(126) 评论(0) 推荐(0)
摘要:1 import java.util.Random; 2 3 public class nihao 4 { 5 public static void main(String[] args) 6 { 7 int[] sz=new int[6];//定义一个数组来存放,来存放随机生成出来的数 8 Random a=new Rando... 阅读全文
posted @ 2016-05-11 15:21 明天会更好!!!! 阅读(822) 评论(0) 推荐(0)
摘要:1 import java.util.*; 2 public class hello 3 { 4 public static void main(String[] args) 5 { 6 Scanner s=new Scanner(System.in); 7 System.out.println("请输入"); 8 ... 阅读全文
posted @ 2016-05-10 22:07 明天会更好!!!! 阅读(141) 评论(0) 推荐(0)
摘要:1 import java.util.*; 2 public class nihao 3 { 4 public static void main(String[] args) 5 { 6 Scanner s=new Scanner(System.in); 7 System.out.println("请输入学生的人数"); ... 阅读全文
posted @ 2016-05-10 22:03 明天会更好!!!! 阅读(597) 评论(0) 推荐(0)
摘要:1 public class helloworld 2 { 3 public static void main(String[] args) 4 { 5 //一维数组 6 int[] a=new int[5];//定义了一个int类型的a数组//new定义了在内存中开辟了一快新的空间//数组的长度等于a.length 7 ... 阅读全文
posted @ 2016-05-10 13:03 明天会更好!!!! 阅读(117) 评论(0) 推荐(0)
摘要:1 import java.util.*; 2 public class nihao 3 { 4 public static void main(String[] args) 5 { 6 Scanner s=new Scanner(System.in); 7 System.out.println("请输入1——7数字"); 8 ... 阅读全文
posted @ 2016-05-09 23:47 明天会更好!!!! 阅读(149) 评论(0) 推荐(0)
摘要:1 public class nihao 2 { 3 public static void main(String[] args) 4 { 5 while()//后面切勿加分号,否则会变为死循环 6 { 7 System.out.println();//当条件成立时输出结果 8 } 9 ... 阅读全文
posted @ 2016-05-09 21:54 明天会更好!!!! 阅读(132) 评论(0) 推荐(0)