Note that there are some explanatory texts on larger screens.

plurals
  1. POCreating UML for the Java code
    text
    copied!<p>I have to create UML diagram for the two Java program/code written below. My queries are:</p> <ul> <li>Is a sub class of an interface also an interface?</li> <li>Is a class implementing Runnable Interface also an interface?</li> <li>Can't methods/functions be called Operations of a class?</li> <li>Are global variables the only attributes of a class or local variables within a function can also be called so?</li> <li>In the 2nd Program the author is sending an object to the Thread constructor. Is it correct?</li> </ul> <p>Aside: Can someone body please draw the UML for the two programs? I'm having hard time with understanding Threads, interface &amp; related keywords like extends, implements.</p> <p><em><strong>JAVA CODE #1</em></strong></p> <pre><code>public class RunThreads { public static void main(String[] args) { SomeThread p1=new new SomeThread(1); p1.start(); SomeThread p2=new new SomeThread(2); p2.start(); SomeThread p3=new new SomeThread(3); p3.start(); } } // end class RunThreads public class SomeThread extends Thread { { int myID; SomeThread(int id) { this.myID=id; } public void run() { int i; for(i = 1; i &lt; 11; i++) System.out.println("Thread" + myID + ": " + i); } } // end class SomeThread </code></pre> <p><em><strong>JAVA CODE #2</em></strong></p> <pre><code>public class RunThreads2 { public static void main(String[] args) { Thread p1 = new Thread(new SomeThread2(1)); p1.start(); Thread p2 = new Thread(new SomeThread2(2)); p2.start(); Thread p1 = new Thread(new SomeThread2(3)); p3.start(); } } // end class RunThread2 class SomeThread2 implements Runnable { int myID; SomeThread2(int id) { this.myID = id; } public void run() { int i; for(i=1; i&lt;11; i++) System.out.println("Thread " + myID + ": " + i); } } // end class SomeThread2 </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload