上一页 1 ··· 7 8 9 10 11 12 13 14 15 16 下一页

2013年9月8日

Exceptions Interview Questions

摘要: Exceptions Interview QuestionsQ1) What is an Exception?Ans) The exception is said to be thrown whenever an exceptional event occurs in java which signals that something is not correct with the code written and may give unexpected result. An exceptional event is a occurrence of condition which alters 阅读全文

posted @ 2013-09-08 14:40 brave_bo 阅读(327) 评论(0) 推荐(0)

死锁问题详解

摘要: synchronized 关键字,代表这个方法加锁,相当于不管哪一个线程A每次运行到这个方法时,都要检查有没有其它正在用这个方法的线程B(或者C D等),有的话要等正在使用这个方法的线程B(或者C D)运行完这个方法后再运行此线程A,没有的话,直接运行它包括两种用法:synchronized 方法和 synchronized 块。 1. synchronized 方法: 通过在方法声明中加入 synchronized关键字来声明 synchronized 方法。如: publicsynchronizedvoid accessVal(int newVal); synchronized ... 阅读全文

posted @ 2013-09-08 14:29 brave_bo 阅读(261) 评论(0) 推荐(0)

implement singleton

摘要: Two way to implement singleton patternpostedSep 12, 2011, 1:35 PMby Akrem AYADI [updatedSep 12, 2011, 2:00 PM]You find bellow the two ways to implemen... 阅读全文

posted @ 2013-09-08 14:29 brave_bo 阅读(315) 评论(0) 推荐(0)

2013年9月6日

OOP parking slot

摘要: public interface Permission{ float getFee(Calendar start, Calendar end);}class ParkingLot{ private list freeRegularSpace; private list freeCompactSpace; private list freeHandicappedSpace;public ParkingLot(); public ParkingSpace allocateFreeSpace(ParkingSpaceType pspaceType) { ... 阅读全文

posted @ 2013-09-06 14:00 brave_bo 阅读(373) 评论(0) 推荐(0)

2013年8月22日

java 核心概念题

摘要: 1. What is immutable object? Can you write immutable object?for example : String.For an object to be immutable, there has to be no way to change fields, mutable or not, and to access fields that are mutable.Here is an example of a mutable object.import java.util.ArrayList;import java.util.LinkedList 阅读全文

posted @ 2013-08-22 09:29 brave_bo 阅读(307) 评论(0) 推荐(0)

OOP clothing store

摘要: Design Clothing store using OOP concepts. based on your design tell how you'll find if the store has XXL size of a particular shirt.package OOP.clothstore;import java.util.ArrayList;import java.util.Hashtable;class cloth{String brand;String barCode;Type type;Size size;enum Size{xs,s,m,l,xl,xxl}; 阅读全文

posted @ 2013-08-22 02:51 brave_bo 阅读(241) 评论(0) 推荐(0)

OOP Train & reservation system

摘要: import java.util.ArrayList;import java.util.Hashtable;class station{String stationID;}class Train{String trainID;int numOfCars;int maxCapacity;int NumOfPassenger;float price;Hashtable schedule;//time, station}public class trainReservation {//id, trainHashtable trains = new Hashtable ();float reserv. 阅读全文

posted @ 2013-08-22 02:47 brave_bo 阅读(150) 评论(0) 推荐(0)

2013年8月21日

OOP design table chair bench

摘要: abstract class material{ int weight;}class wood extends material{}class plastic extends material{}class metal extends material{}interface furniture { material getMaterial(); void setMaterial(material m);}class table implements furniture{ material mat; public material getMaterial(){ ... 阅读全文

posted @ 2013-08-21 07:06 brave_bo 阅读(218) 评论(0) 推荐(0)

oop person&body

摘要: public class person { BloodType bloodtype; enum BloodType{A,B,O}; String FirstName, LastName; String BirthDay; Body body;}abstract class part{ float weight; void setWeight(float w){ weight = w;} float getWeight(){ return weight;}}class Body{ Arm[] arms; Head head; L... 阅读全文

posted @ 2013-08-21 07:03 brave_bo 阅读(140) 评论(0) 推荐(0)

设计系统题

摘要: 给个猜词小游戏的app,显示一个合法string的anagram,要求用户一分钟内给答案,返回对错,time out之后返回所有的正确答案。dictionary作为list,已知。 (预处理dictionary,用hashtable存,key是string排序后的结果,每个slot用bst存,时间为logk)eg:给atme,正确答案包括team, mate, meat, tame 阅读全文

posted @ 2013-08-21 06:44 brave_bo 阅读(113) 评论(0) 推荐(0)

上一页 1 ··· 7 8 9 10 11 12 13 14 15 16 下一页

导航