亚洲免费人人妻人人,cao78在线视频,福建一级毛片,91精品视频免费观看,高清另类图片操逼,日本特黄特色大片免费看,超碰欧美人人澡曰曰澡夜夜泛

時(shí)間:2024-07-28 17:11:54 資料大全 我要投稿
  • 相關(guān)推薦

富士康企業(yè)集團(tuán)招聘Java題目筆試題目

  編程題:

富士康企業(yè)集團(tuán)招聘Java題目筆試題目

  1、繼承時(shí)候類的執(zhí)行順序問(wèn)題,一般都是選擇題,問(wèn)你將會(huì)打印出什么?

  答:父類:

  package test;

  public class FatherClass

  {

  public FatherClass()

  {

  System.out.println(“FatherClass Create”);

  }

  }

  子類:

  package test;

  import test.FatherClass;

  public class ChildClass extends FatherClass

  {

  public ChildClass()

  {

  System.out.println(“ChildClass Create”);

  }

  public static void main(String[] args)

  {

  FatherClass fc = new FatherClass();

  ChildClass cc = new ChildClass();

  }

  }

  輸出結(jié)果:

  C:>java test.ChildClass

  FatherClass Create

  FatherClass Create

  ChildClass Create

  2、內(nèi)部類的實(shí)現(xiàn)方式?

  答:示例代碼如下:

  package test;

  public class OuterClass

  {

  private class InterClass

  {

  public InterClass()

  {

  System.out.println(“InterClass Create”);

  }

  }

  public OuterClass()

  {

  InterClass ic = new InterClass();

  System.out.println(“OuterClass Create”);

  }

  public static void main(String[] args)

  {

  OuterClass oc = new OuterClass();

  }

  }

  輸出結(jié)果:

  C:>java test/OuterClass

  InterClass Create

  OuterClass Create

  再一個(gè)例題:

  public class OuterClass {

  private double d1 = 1.0;

  //insert code here

  }

  You need to insert an inner class declaration at line 3. Which two inner class declarations are

  valid?(Choose two.)

  A. class InnerOne{

  public static double methoda() {return d1;}

  }

  B. public class InnerOne{

  static double methoda() {return d1;}

  }

  C. private class InnerOne{

  double methoda() {return d1;}

  }

  D. static class InnerOne{

  protected double methoda() {return d1;}

  }

  E. abstract class InnerOne{

  public abstract double methoda();

  }

  說(shuō)明如下:

  一.靜態(tài)內(nèi)部類可以有靜態(tài)成員,而非靜態(tài)內(nèi)部類則不能有靜態(tài)成員,

富士康企業(yè)集團(tuán)招聘Java題目筆試題目

,

資料共享平臺(tái)

富士康企業(yè)集團(tuán)招聘Java題目筆試題目》(http://m.msguai.com)。

  故 A、B 錯(cuò)

  二.靜態(tài)內(nèi)部類的非靜態(tài)成員可以訪問(wèn)外部類的靜態(tài)變量,而不可訪問(wèn)外部類的非靜態(tài)變量;return d1 出錯(cuò)。

  故 D 錯(cuò)

  三.非靜態(tài)內(nèi)部類的非靜態(tài)成員可以訪問(wèn)外部類的非靜態(tài)變量。

  故 C 正確

  四.答案為C、E

  3、Java 的通信編程,編程題(或問(wèn)答),用JAVA SOCKET編程,讀服務(wù)器幾個(gè)字符,再寫(xiě)入本地顯示?

  答:Server端程序:

  package test;

  import java.net.*;

  import java.io.*;

  public class Server

  {

  private ServerSocket ss;

  private Socket socket;

  private BufferedReader in;

  private PrintWriter out;

  public Server()

  {

  try

  {

  ss=new ServerSocket(10000);

  while(true)

  {

  socket = ss.accept();

  String RemoteIP = socket.getInetAddress().getHostAddress();

  String RemotePort = “:”+socket.getLocalPort();

  System.out.println(“A client come in!IP:”+RemoteIP+RemotePort);

  in = new BufferedReader(new

  InputStreamReader(socket.getInputStream()));

  String line = in.readLine();

  System.out.println(“Cleint send is :” + line);

  out = new PrintWriter(socket.getOutputStream(),true);

  out.println(“Your Message Received!”);

  out.close();

  in.close();

  socket.close();

  }

  }catch (IOException e)

  {

  out.println(“wrong”);

  }

  }

  public static void main(String[] args)

  {

  new Server();

  }

  };

  Client端程序:

  package test;

  import java.io.*;

  import java.net.*;

  public class Client

  {

  Socket socket;

  BufferedReader in;

  PrintWriter out;

  public Client()

  {

  try

【】相關(guān)文章:

小學(xué)感恩節(jié)活動(dòng)方案06-20

公司離職證明范文5篇07-11

職場(chǎng)人士勵(lì)志故事10-21

河南全國(guó)教師信息采集08-30

搞笑的新婚祝福語(yǔ)大全10-26

工作勵(lì)志格言精選08-22

服裝市場(chǎng)調(diào)查報(bào)告10-18

三年級(jí)蜜蜂教學(xué)反思10-25

解決問(wèn)題教學(xué)反思10-29

幼兒園讀書(shū)的倡議書(shū)06-23