java基礎題

來源:互聯網
上載者:User

標籤:art   sys   封裝類   origin   net   class   led   get   sdn   

1.java編譯運行過程---能畫圖詳解

2.JDK、JRE、JVM三者關係

3.8大基本類型以及取值範圍--補碼的介紹https://wenku.baidu.com/view/d17dd4ba1a37f111f1855b10.html

4.基本類型間的轉換

5.switch從jdk1.7開始支援字串做為運算式:原理http://blog.csdn.net/queenjade/article/details/44778653

6.初始化數組:

注意:

int[] a = new int[]{1,23};
int[] b= {1,2};
int[] c;
c = new int[5];

如果寫成了:

int[] a = new int[2]{1,23};

int[] c;
c = {1,2};

則是錯誤的寫法。

數組複製:System.arraycopy(src, srcPos, dest, destPos, length);以及Arrays.copyOf(original, newLength);

 

StringBuilder的一些方法要熟練掌握。

String、StringBuilder、StringBuffer區別

字串比較:

 String s4 = "123abc";和String s5 = "123"+"abc";這兩個是相同的,它們是字面量直接相加。因此是可以的。而如果

String s6 = "123";
String s7 = s6+"abc";

則s7和s4是不同的。

重寫equals方法代碼熟練掌握。

equals和==區別。

封裝類是不可變類。注意八種封裝類的基本類型以及父類的區別。

封裝類的常用方法。

自動拆箱和裝箱的代碼實現原理。Integer.valueOf(100);int a = b.intValue();

SimpleDateFormat的方法:SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:ss:mm");Date date = sdf.parse(string);String str = sdf.format(date); 

Calendar的方法的應用。

集合常用方法要熟練掌握。比如isEmpty().

集合和迭代器之間的聯絡以及代碼實現。

迭代器在刪除的時候不能使用集合的remove去刪除,必須使用迭代器的remove方法。

泛型的考點暫時不清楚。

list.get(index)和list.set(index,element)元素的應用。比如list.set(1,list.set(3,list.get(1)))則表示將1和3位置元素互換,注意,set方法會將原來位置的元素返回。

list轉換為數組:

String[] strings = (String[]) list.toArray();必須強轉,否則報錯。

String[] str = list.toArray(new String[]{});

數群組轉換為集合:

List<String> list = Arrays.asList(array);

注意:從數群組轉換過來的集合,是不能添加元素的也不能刪除元素,因為這會導致數組擴容或縮容,這就無法表示原來的數組。但是,可以修改元素的值。

Comparable介面:比較的類比如Cell必須實現該介面,然後重寫其調用的方法。int compareTo(Cell o){};Collections.sort(cells);比較結果傳回值,>0 <0 =0

Comparator介面:直接寫個比較子的類實現Comparator介面介面,重寫其方法int compare(T t1,T t2){};然後,Collections.sort(cells,comparatorClass);

注意,在Comparator中聲明其類型為String

class MyComparator implements Comparator<String>{
/**
* 比較規則:字元多的大
*/
public int compare(String o1, String o2) {
return o1.length()-o2.length();
}
}

Map以及HashMap的面試。

java基礎題

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.