: :
: :
استيراد java.io.filenotfoundException ؛ استيراد java.io.ioException ؛ استيراد java.util.arraylist ؛ استيراد java.util.concurrent.executorservice ؛ استيراد java.util.concurrent.executors ؛/** ** ** تم إنشاؤه بواسطة ysc في 7/26/16. */مقابلة الفئة العامة {private static void one () {String str1 = "hello" ؛ String str2 = "He"+New String ("llo") ؛ System.err.println (str1 == Str2) ؛ system.out.println ("1. false") ؛ } private static void two () {int i = integer.max_value ؛ System.err.println ((i+1) <i) ؛ System.out.println ("2. 存在一个 i ، 使得 (i+1) <i") ؛ } private static void three () {system.err.println ("GC ليس مؤشر ترابط Java ، إنه مؤشر ترابط أصلي") ؛ thread.getAllStackTraces (). KeySet (). System.out.println ("3. GC 线程是 daemon 线程") ؛ } العد الثابت الثابتة الثابتة = 0 ؛ private static void Four () {eventorservice evectororService = Executors.NewCachedThreadPool () ؛ لـ (int j = 0 ؛ j <10 ؛ j ++) {executorService.submit (()-> {for (int i = 0 ؛ i <1000000 ؛ i ++) {count ++ ؛}}) ؛ } system.out.println ("يجب أن يكون العدد:" +10000000+ "، فعلي be:"+count) ؛ System.out.println ("4. Folatile 不能保证线程安全") ؛ } private static void Five () {ArrayList <integer> list = new ArrayList <> (20) ؛ list.add (1) ؛ System.out.println ("رمز التصحيح ، لا تنفذ طريقة النمو") ؛ System.out.println ("5. قائمة تنمو 0 مرات") ؛ } private static void Six () {system.out.println ("BufferedReader's Constructor يقبل فقط مثيل القارئ") ؛ System.out.println ("6. New BufferedReader (FileInputStream جديد (/" A.DAT/")) ؛ خطأ") ؛ } private static void Seven () {try {if (true) {throw new ioException () ؛ }} catch (fileNotfoundException e) {system.out.print ("fileNotFoundException!") ؛ } catch (ioException e) {system.out.print ("ioException!") ؛ } catch (استثناء e) {system.out.print ("استثناء!") ؛ } system.out.println ("/n7. ioException!") ؛ } private static void ثمانية () {system.out.println ("string s ؛ system.out.println (s) ؛ خطأ: قد لا يتم تهيئة المتغير/nrecompile باستخدام -xlint: unchected for details.") ؛ System.out.println ("8. 由于 string s 没有初始化 ، 代码不能编译通过") ؛ } private static void N9 () {system.out.println ("5" +2) ؛ System.out.println ("9. 52") ؛ } private static void ten () {int i = 2 ؛ int النتيجة = 0 ؛ Switch (i) {case 1: result = result + i ؛ الحالة 2: النتيجة = النتيجة + i * 2 ؛ الحالة 3: النتيجة = النتيجة + i * 3 ؛ } system.out.println ("result ="+result) ؛ System.out.println ("10. 10") ؛ } الفئة الثابتة الخاصة null {public static void hello () {system.out.println ("hello") ؛ } public static void main (string [] args) {((null) null) .hello () ؛ null _null = (null) null ؛ _null.hello () ؛ }} private static class stringexample1 {String str = new String ("good") ؛ char [] ch = {'a' ، 'b' ، 'c'} ؛ تغيير الفراغ العام (String str ، char [] ch) {str = "test ok" ؛ ch [0] = 'g' ؛ } public static void main (string [] args) {StringExample1 ex = new stringExample1 () ؛ ex.Change (ex.Str ، ex.Ch) ؛ System.out.print (ex.Str+"و") ؛ system.out.print (ex.ch) ؛ System.out.println () ؛ }} private static class stringexample2 {public static void change (String str) {str = "welcome" ؛ } public static void main (string [] args) {String str = "1234" ؛ التغيير (STR) ؛ system.out.println (str) ؛ }} فئة ثابتة خاصة forloop {static boolean foo (char c) {system.out.print (c) ؛ العودة صحيح. } public static void main (string [] args) {int i = 0 ؛ لـ (foo ('a') ؛ foo ('b') && (i <2) ؛ foo ('c')) {i ++ ؛ طعام')؛ } system.out.println () ؛ }} الفئة الثابتة الخاصة helloa {public helloa () {system.out.println ("helloa") ؛ } {system.out.println ("أنا فئة") ؛ } static {system.out.println ("static a") ؛ }} private static class hellob يمتد helloa {public hellob () {system.out.println ("hellob") ؛ } {system.out.println ("أنا B Class") ؛ } static {system.out.println ("static b") ؛ } public static void main (string [] args) {system.out.println ("Main Start") ؛ New Hellob () ؛ New Hellob () ؛ system.out.println ("Main End") ؛ }} public static void main (string [] args) {one () ؛ اثنين()؛ ثلاثة()؛ أربعة () ؛ خمسة()؛ ستة()؛ سبعة()؛ ثمانية()؛ تسعة()؛ عشرة()؛ null.main (null) ؛ StringExample1.main (NULL) ؛ StringExample2.main (NULL) ؛ forloop.main (null) ؛ Hellob.main (NULL) ؛ }}以上就是本文的全部内容 , 希望对大家的学习有所帮助 , 也希望大家多多支持武林网。