?? cola.java
字號:
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package examen;import java.util.*;/** * * @author ANGEL */public class cola { LinkedList l; boolean lectura; boolean escritura; int id; cola(boolean lectura, boolean escritura,int id){ l = new LinkedList(); this.lectura = lectura; this.escritura = escritura; this.id = id; } void meter(String dato){ if(!dato.equals("") ){ l.offer(dato); } } String sacar(){ String valor = "no hay dato"; try{ valor = (String)l.poll(); }catch(NoSuchElementException e){ valor = "no hay dato"; } return valor; } void recorrer(){ System.out.println("Recorrido Cola "+id +" "+l); } void invertir(){ if(lectura){ lectura = false; escritura = true; }else if(escritura){ escritura = false; lectura = true; } } String tipo(){ if(escritura) return "[escritor]"; else return "[lector]"; }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -