Question: Consider the following Java codes, state whether they are correct or not. State the reasons for incorrect ones. public class BufferClass { private static final

 Consider the following Java codes, state whether they are correct ornot. State the reasons for incorrect ones. public class BufferClass { private

Consider the following Java codes, state whether they are correct or not. State the reasons for incorrect ones. public class BufferClass { private static final int CAPACITY = 5; // buffer size private LinkedList queue = new LinkedList(); // Method 'write should wait until the input 'value' can be added public synchronized void write(int value) { try { if (queue.size() == CAPACITY) { System.out.println("Buffer full..."); wait(); } queue.offer(value); notifyAll(); } catch (InterruptedException ex) { ex.printStackTrace(); } } (b) // Client side program try { Socket s = new Socket (Socket("127.0.0.1", 8888); DataOutputStream dout = new DataOutputStream(s.getInputStream()); } catch (Exception e) { e.printStackTrace(); ) . (c) DataInputStream din; // Assume DataInputStream object 'din' is initialized properly. din.readBoolean(); // Get a boolean value from sender for further // manipulation. (d) Connection connection; // Assume Connection object 'connection is initialized properly. try { String str = "select * from student"; PreparedStatement pstmt = connection.prepareStatement(str); pstmt.executeUpdate(); (e) Shopping Cart.jsp JavaBean 'connection is created for handling database manipulation. JavaBean 'cart is created for storing product(s) selected by a particular customer. Assume the two classes MyConnection and ShoppingCart are defined. --%>

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!