Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2008
    Posts
    4
    Rep Power
    0

    Thumbs up challanging question

    4
    Public class Geo{
    Public static void main(String [] args){
    Geo g=new Geo();
    final Object o1 = new Object();
    fnal Object o2= new Object();
    thread tx = new Thread (new Runnable(){
    public void run(){
    synchronized (o1){
    synchronized (o2){
    calc();
    }
    }
    }
    });

    thread ty = new Thread (new Runnable(){
    public void run(){
    synchronized (o1){
    synchronized (o2){
    calc();
    }
    }
    }
    });
    tx.start();
    ty.start();
    }
    }
    Which of the following about the geo.java program is true?
    a) an exception can occur because of two threads.
    b) The program contains invalid synchronize statements.
    c) A deadlock situation can occur with the two threads.
    d) The program is constructed in a way that will avoid deadlock.
    Ans;-



    also answer the question in attachment file
    Attached Files Attached Files
    Last edited by abhinav_jain09; 09-18-2008 at 08:29 AM.

  2. #2
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    Hardly. Stop cross-posting/flooding the forum with this question. No one is going to do your homework/test for you. You'd do better to study next time.

  3. #3
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Seems that we have a mess with homework here. Please keep in mind that better try something first yourself and if you stuck ask any question. Definitely we help to solve your issues. But no one here for doing your homework.

Similar Threads

  1. Question mark colon operator question
    By orchid in forum Advanced Java
    Replies: 9
    Last Post: 12-19-2010, 08:49 AM
  2. question
    By zizou147 in forum New To Java
    Replies: 13
    Last Post: 07-04-2008, 07:05 PM
  3. question on jsp
    By munigantipraveen in forum JavaServer Pages (JSP) and JSTL
    Replies: 2
    Last Post: 06-30-2008, 02:47 PM
  4. Need help on this question
    By Deon in forum New To Java
    Replies: 3
    Last Post: 01-27-2008, 03:58 PM
  5. Need help with a question please
    By sonal in forum New To Java
    Replies: 1
    Last Post: 11-29-2007, 09:17 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •