题解 | #十进制数转二进制数#
排队系统
http://www.nowcoder.com/practice/ce3eb547dfb1418aa17ad2f2b8c4e07a
import java.util.*; public class Main { public static void main(String[] args) { Guest guest1 = new Guest("小明",false); Guest guest2 = new Guest("小军",false); Guest vipGuest = new Guest("小红",true); Deque<Guest> deque = new ArrayDeque<>(); deque.add(guest1); deque.add(guest2); //write your code here...... //add抛出异常 //deque.addFirst(vipGuest); //offer返回布尔值 deque.offerFirst(vipGuest); System.out.println(deque); } } class Guest{ String name; Boolean vip; @Override public String toString() { return name; } public Guest(String name, Boolean vip) { this.name = name; this.vip = vip; } }