【Java每日一题】20170310】的更多相关文章

20170309问题解析请点击今日问题下方的“[Java每日一题]20170310”查看(问题解析在公众号首发,公众号ID:weknow619) package Mar2017; public class Ques0310 { static void test() { System.out.println("test method in Test class"); } public static void main(String[] args) { Ques0310 test = ne…
20170310问题解析请点击今日问题下方的“[Java每日一题]20170313”查看(问题解析在公众号首发,公众号ID:weknow619) package Mar2017; import java.io.IOException; public class Ques0313 { public static void main(String[] args) { System.out.println("before try"); try{ }catch (IOException e)…
20170105问题解析请点击今日问题下方的"[Java每日一题]20170106"查看(问题解析在公众号首发,公众号ID:weknow619) package Jan2017; public class Ques0106 { public void method01(String... strings, int num){ } public void method02(String... strings, int... is){ } } 今日问题: 以上两个方法使用了变长参数,请问这…
20170104问题解析请点击今日问题下方的"[Java每日一题]20170105"查看(问题解析在公众号首发,公众号ID:weknow619) package Jan2017; import java.util.ArrayList; import java.util.List; public class Ques0105 { public static void main(String[] args) { List<String> list = new ArrayList…
20170103问题解析请点击今日问题下方的"[Java每日一题]20170104"查看(问题解析在公众号首发,公众号ID:weknow619) package Jan2017; import java.util.HashSet; import java.util.Set; public class Ques0104{ public static void main(String[] args){ Obj obj01 = new Obj("张三"); Obj obj…
20161230问题解析请点击今日问题下方的"[Java每日一题]20170103"查看(问题解析在公众号首发,公众号ID:weknow619) package Jan2017; public class Ques0103 { public static void main(String[] args){ System.out.println(delete("你好", "你").equals("好")); System.out…
// 20161229问题解析请点击今日问题下方的"[Java每日一题]20161230"查看(问题解析在公众号首发,公众号ID:weknow619)package Dec2016; public class Ques1230 { int array = {1, 2, 3}; // 1 int array[] = {1, 2, 3}; // 2 int[] array = {1, 2, 3}; // 3 int array[] = new int{1, 2, 3}; // 4 int…
package Dec2016; import java.util.ArrayList; import java.util.List; public class Ques1229 { public static void main(String[] args){ Student stu01 = new Student("001"); Student stu02 = new Student(null); List<Student> students = new ArrayLi…
package Dec2016; import java.util.ArrayList; import java.util.List; public class Ques1228 { public static void main(String[] arg){ Student stu01 = new Student("001"); Student stu02 = new Student("001 "); // stu02中001后面有个空格 List<Stud…
package Dec2016; public class Ques1227 { public static void main(String[] args){ } { c = 1; } int c = 2; int a = b; int b = 3; } 今日问题: 请问主程序输出结果是什么?(点击以下"[Java每日一题]20161227"查看20161226问题解析) 题目原发布于公众号.简书:[Java每日一题]20161227,[Java每日一题]20161227 注:wek…
package Dec2016; public class Ques1226 { static{ num = 1; } public static int num = 2; public static void main(String[] args) { System.out.println(num); } } 今日问题: 请问主程序输出结果是什么?(点击以下"[Java每日一题]20161226"查看20161223问题解析) 题目原发布于公众号.简书:[Java每日一题]20161…
package Dec2016; public class Ques1223 { public static void main(String[] args){ Integer obj = Integer.valueOf(args[args.length - 1]); int i = obj.intValue(); if (args.length > 1) { System.out.println(i); } if (args.length > 0) { System.out.println(…
package Dec2016; import java.util.Random; public class Ques1222 { public static void main(String[] args){ System.out.println("输出常量:"+Test.NUM); } } interface Test{ public static final float NUM = new Random().nextFloat(); } 今日问题: 请问主程序输出的值是不变的吗?…
package Dec2016; public class Ques1221 { } class Parent{ public void test(){ System.out.println("Parent test"); } } class Sub extends Parent{ public String test(){ System.out.println("Sub test"); } } 今日问题: 请问主程序是否有编译错误?(点击以下"[Java…
package Dec2016; public class Ques1220 { public static void main(String[] args) { Integer num1 = new Integer(100); Integer num2 = new Integer(100); compare(num1, num2); } public static void compare(Integer a, Integer b){ System.out.println(a == b); S…
package Dec2016; import java.util.Arrays; public class Ques1219 { public static void main(String[] args) { int num = 2; Dog[] dogs01 = new Dog[num]; // dogs01中有两只狗 for(int i = 0; i < num; i++){ dogs01[i] = new Dog(i, Color.values()[i]); } Dog[] dogs0…
package Dec2016; import java.util.ArrayList; import java.util.List; public class Ques1216 { public static void main(String[] args) { List<String> list01 = new ArrayList<String>(); List<Integer> list02 = new ArrayList<Integer>(); Sy…
package Dec2016; public class Ques1215 { static final int num1 = 2; static final int num2 = 3; static int num3 = 2; static int num4 = 3; public static void main(String[] args){ int result1 = num1 * num2; // 1 int result2 = num3 * num4; // 2 } } 今日问题:…
package Dec2016; import java.util.ArrayList; import java.util.List; public class Ques1214 { public static void main(String[] args){ final List<String> tickets = new ArrayList<String>(); for(int i = 0; i < 1000; i++){ tickets.add("高铁票-&…
package Dec2016; public class Ques1213 { public static void main(String[] args){ String str1 = "编程"; String str2 = "编程"; String str3 = new String("编程"); String str4 = str3.intern(); System.out.print(str1==str2); //两直接量相比 Syst…
package Dec2016; public class Ques1212 { public static void main(String[] args){ System.out.println(10.00-9.60); } } 今日问题: 请问主程序中输出结果是什么?(点击以下“[Java每日一题]20161212”查看20161209问题解析) 题目原发布于公众号.简书:[Java每日一题]20161212,[Java每日一题]20161212…
package Dec2016; public class Ques1209 { public static void main(String[] args){ People g = new People("张三"); // 定义监护人 People p1 = new People("儿子1", g); People p2 = p1.clone(); // 儿子2的信息通过拷贝儿子1来的 p2.setName("儿子2"); p1.getGuar…
package Dec2016; import java.util.List; public class Ques1208 { public static void add(List<? extends Number> list){ // 加入一个元素 list.add(123); } } 今日问题: 请问主程序能否正常运行输出结果?(点击以下"[Java每日一题]20161208"查看20161207问题解析) 题目原发布于公众号.简书:[Java每日一题]2016120…
package Dec2016; public class Ques1207 { public static void main(String[] args) { new Test(); new Test(1); new Test("1"); System.out.println("实例数量为:"+Test.getNumOfInstances()); } } class Test{ private static int numOfInstances = 0; //…
package Dec2016; public class Ques1206 { public static void main(String[] args){ doSex(null); } public static void doSex(Sex sex){ switch (sex) { case Boy: System.out.println("男的"); break; case Girl: System.out.println("女的"); break; de…
package Dec2016; import java.util.HashSet; public class Ques1205 { public static void main(String[] args){ StringBuffer sb1 = new StringBuffer("123"); StringBuffer sb2 = new StringBuffer("123"); StringBuffer sb3 = new StringBuffer(&quo…
20161201问题解析请点击今日问题下方的"[Java每日一题]20161202"查看 package Dec2016; public class Ques1202 { public static void main(String[] args) { int num = 127; // 如果是128呢 Integer n1 = new Integer(num); Integer n2 = new Integer(num); System.out.println("new产生…
20161130问题解析请点击今日问题下方的"[Java每日一题]20161201"查看 package Dec2016; public class Ques1201 { public static void main(String[] args) { new Ques1201().sum(1, 2); } public void sum(int num1, int num2){ int temp = num1 + num2; System.out.println("没使用变…
20161129问题解析请点击今日问题下方的"[Java每日一题]20161130"查看 package Nov2016; public class Ques1130 { public static void main(String[] args) { int i = 1; Ques1130.test(i); Ques1130.test(Integer.valueOf(i)); } public static void test(long n){ System.out.println(…
package Nov2016; public class Ques1129 { public static void main(String[] args) { final String str = "123"; str = "1234"; System.out.println(str); final StringBuffer sb = new StringBuffer("123"); sb.append("4"); Sys…