日本无码中文字幕片|日本精品在线观看无码视频|国产精品免费啪啪|Av无码一区二区|亚洲在线黄片免费观看|亚洲日韩中文字幕在线观看|熟女激情乱伦在线观看a黄片|成年人观看毛片网址|AV色色色色日韩性草|国产高清无码免费

科目二坡道定點(diǎn)起步操作圖解

時(shí)間:2025-12-14 00:03:22 科目二 我要投稿

科目二坡道定點(diǎn)起步操作圖解

  第一題 :棧內(nèi)存與堆內(nèi)存的特點(diǎn)與區(qū)別,java中是怎樣分配的?

科目二坡道定點(diǎn)起步操作圖解

  棧內(nèi)存中用來存放基本數(shù)據(jù)類型(8種基本類型)和對(duì)象的引用變量,存取速度比堆快,棧中的數(shù)據(jù)可以被共享使用,堆內(nèi)存中用來存放new創(chuàng)建的對(duì)象和數(shù)組對(duì)象。

  第二題:對(duì)象序列化,作用,那些不能序列化?

  對(duì)象序列化是為了能夠讓對(duì)象像其他變量數(shù)據(jù)一樣能夠長(zhǎng)久的保存下來,其實(shí)質(zhì)是把對(duì)象在內(nèi)存中的數(shù)據(jù)按照一定的規(guī)則,變成一系列的字節(jié)數(shù)據(jù),然后寫入到流中。沒有實(shí)現(xiàn)java.io.Seralizabled接口的類不能實(shí)例化。

  第三題 線程的p、v操作

  線程對(duì)于程序員而言,是比較重要的一塊知識(shí),不會(huì)線程編程,就算不上一個(gè)合格的程序員。因此,線程也是各個(gè)公司筆試面試必考的內(nèi)容之一。PV操作本是操作系統(tǒng)中相關(guān)的內(nèi)容,簡(jiǎn)單來說,P操作是申請(qǐng)資源,V操作是釋放資源。本題最好可以用生產(chǎn)者/消費(fèi)者來實(shí)現(xiàn)PV操作最為合適,同時(shí)也考慮到了多線程同步的問題。舉例說明:

  package common;

  import org.junit.Test;

  /**

  * PV操作示例

  * @author xcbeyond

  *

  * 2012-10-2下午08:05:09

  */

  public class PVOperator {

  public static void main(String [] args){

  Store s = new Store(5);

  Produce pro1 = new Produce(s);

  Produce pro2 = new Produce(s);

  Consumer con1 = new Consumer(s);

  Consumer con2 = new Consumer(s);

  pro1.start();

  con1.start();

  pro2.start();

  con2.start();

  }

  }

  /**

  * 倉庫類:臨界資源

  *

  */

  class Store{

  private final int maxSize; /pic/p>

  private int count;

  public Store(int size){

  maxSize = size;

  count = 0;

  }

  /**

  * 添加資源

  */

  public synchronized void add(){

  while(count >=maxSize){

  System.out.println("----倉庫滿了!----");

  try {

  wait();

  } catch (InterruptedException e) {

  e.printStackTrace();

  }

  }

  count++;

  System.out.println(Thread.currentThread().toString()+ "put" +count);

  notifyAll();

  }

  public synchronized void remove() {

  while(count <= 0) {

  System.out.println("----倉庫空了!----");

  try {

  wait();

  } catch (InterruptedException e) {

  e.printStackTrace();

  }

  }

  System.out.println(Thread.currentThread().toString()+ "get"+count);

  count--;

  notify();

  }

  }

  /**

  * 生產(chǎn)者:P操作

  */

  class Produce extends Thread {

  private Store s;

  public Produce(Store s) {

  this.s = s;

  }

  @Override

  public void run() {

  while(true){

  s.add();

  try {

  Thread.sleep(1000);/pic/p>

  } catch (InterruptedException e) {

  e.printStackTrace();

  }

  }

  }

  }

  /**

  * 消費(fèi)者:V操作

  */

  class Consumer extends Thread {

  private Store s;

  public Consumer(Store s) {

  this.s = s;

  }

  @Override

  public void run() {

  while(true) {

  s.remove();

  try {

  Thread.sleep(1000);

  } catch (InterruptedException e) {

  e.printStackTrace();

  }

  }

  }

  }

【科目二坡道定點(diǎn)起步操作圖解】相關(guān)文章:

科目二坡道定點(diǎn)停車和起步操作技巧圖解05-16

科目二坡道定點(diǎn)停車與起步操作05-07

科目二坡道定點(diǎn)圖解03-18

科目二坡道起步圖解03-14

科目二坡道定點(diǎn)停車與起步的操作方法04-12

科目二坡道定點(diǎn)停車和起步操作步驟04-17

科目二坡道定點(diǎn)停車與起步操作技巧詳解01-27

科目二坡道定點(diǎn)停車和起步怎么操作03-11

科目二坡道起步操作技巧08-25