腾讯面试

This commit is contained in:
xiongraorao
2018-08-24 20:07:40 +08:00
parent 667f850743
commit d0a13478d4
9 changed files with 291 additions and 27 deletions

View File

@ -41,21 +41,27 @@ public class Test {
private int a;
public static void main(String[] args) {
//System.out.println(foo());
int r = new Test().foo();
System.out.println(r);
PriorityBlockingQueue<Integer> aa;
LinkedBlockingQueue<Integer> ss;
ss = new LinkedBlockingQueue<>();
ss.add(1);
ArrayBlockingQueue<Integer> s;
LinkedBlockingQueue<Integer> a;
FileInputStream fis;
FileOutputStream fos;
InputStreamReader isr;
OutputStreamWriter osw;
float b = Math.round(11.5);
System.out.println(b);
// //System.out.println(foo());
// int r = new Test().foo();
// //System.out.println(r);
// PriorityBlockingQueue<Integer> aa;
// LinkedBlockingQueue<Integer> ss;
// ss = new LinkedBlockingQueue<>();
// ss.add(1);
// ArrayBlockingQueue<Integer> s;
// LinkedBlockingQueue<Integer> a;
// FileInputStream fis;
// FileOutputStream fos;
// InputStreamReader isr;
// OutputStreamWriter osw;
// float b = Math.round(11.5);
// //System.out.println(b);
int[] t = new int[]{1,2};
int[] temp = t;
System.out.println(t[0]);
t[0]= 10;
System.out.println(temp[0]);
}
public int foo() {

View File

@ -1,15 +1,9 @@
package com.raorao.java;
import clojure.lang.Obj;
import com.google.common.collect.HashBasedTable;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.Map.Entry;
public class Test implements Serializable {
@ -29,10 +23,10 @@ public class Test implements Serializable {
hashMap.put(2, 20);
hashMap.put(3, 30);
hashMap.put(19, 30);
hashMap.forEach((e1, e2)-> System.out.println( e1 + ":" + e2));
hashMap.forEach((e1, e2) -> System.out.println(e1 + ":" + e2));
Iterator<Entry<Integer, Integer>> iterator = hashMap.entrySet().iterator();
Enumeration<Integer> enumeration = hashMap.elements();
while (enumeration.hasMoreElements()){
while (enumeration.hasMoreElements()) {
System.out.println(enumeration.nextElement());
}