Creating UML for the Java code

I have to create UML diagram for the two Java program/code written below. My queries are: + Is a sub class of an interface also an interface? + Is a class implementing Runnable Interface also an interface? + Can't methods/functions be called Operations of a class? + Are global variables the only attributes of a class or local variables within a function can also be called so? + In the 2nd Program the author is sending an object to the Thread constructor. Is it correct? Aside: Can someone body please draw the UML for the two programs? I'm having hard time with understanding Threads, interface & related keywords like extends, implements. ***JAVA CODE #1*** 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 < 11; i++) System.out.println("Thread" + myID + ": " + i); } } // end class SomeThread ***JAVA CODE #2*** 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<11; i++) System.out.println("Thread " + myID + ": " + i); } } // end class SomeThread2
Can someone body please draw the UML for the two programs? - NO.

以上就是Creating UML for the Java code的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准