And contrast java with

3 ways to create Java threads and contrast __java

Four: Three ways to create a thread comparison
The way to implement the Runnable interface and the Calable interface is basically the same, the Knowledge Calable interface defines a method that has a return value and can declare an exception to be thrown. So they are grouped into one category. The difference between this approach and the inheritance thread approach is as follows:

@ Create the pros and cons of multithreading in the way that implements the interface:
1 The thread class knowledge implements the Runnable interface or the Calable interface, and can also inherit other classes.
2 in this way, multiple threads can share a target object, ideally suited for multiple identical threads to handle the same resource.
3 Disadvantage is: Programming comparison of the trouble, if you need to access the current thread, you need to call the CurrentThread () method.

@ Use the inheritance thread class to create the advantages and disadvantages of multithreading:
1 The disadvantage is that the thread class has been inherited, so you cannot inherit other parent classes.
2 Advantage is: The code is simple, you can access the current thread directly through this.

Through analysis, it is generally recommended to implement the interface to create multithreading.

Article source http://blog.sina.com.cn/s/blog_e3734cfe0102xsoo.html

This article is an English version of an article which is originally in the Chinese language on aliyun.com and is provided for information purposes only. This website makes no representation or warranty of any kind, either expressed or implied, as to the accuracy, completeness ownership or reliability of the article or any translations thereof. If you have any concerns or complaints relating to the article, please send an email, providing a detailed description of the concern or complaint, to info-contact@alibabacloud.com. A staff member will contact you within 5 working days. Once verified, infringing content will be removed immediately.

Читайте также:  Threading python 3 документация

Источник

IT2301 Java Programming 16 Marks Questions — 5th Semester IT Dept

1. Explain OOP Principles.
2. Explain the features of Java Language.
3. Compare and Contrast Java with C.
4. Compare and Contrast Java with C++.
5. Explain Constructors with examples.
6. Explain the methods available under String and String Buffer Class.
7. Explain the Date Class methods with examples.
8. Discuss in detail the access specifiers available in Java.
9. Explain the different visibility controls and also compare with each of them.
10. Explain the different methods in java.Util.Arrays class with example.
11. Explain Packages in detail.
12. Discuss the methods under Array Class.
13. Discuss some of the classes available under Lang package.
14. Illustrate with examples: static and final.
15. Explain method overriding with example program.
16. What is javaDoc? Explain the comments for classes, methods, fields and link.
17. Application Programs in Java.

1. Explain the concept of inheritance and its types.
2. Explain the concept of overriding with examples.
3. What is dynamic binding? Explain with example.
4. Explain the uses of reflection with examples.
5. Define an interface. Explain with example.
6. Explain the methods under “object” class and “class” class.
7. What is object cloning? Explain deep copy and shallow copy with examples.
8. Explain static nested class and inner class with examples.
9. With an example explain proxies.
10. Develop a message abstract class which contains playMessage abstract method. Write a different sub-classes like TextMessage, VoiceMessage and FaxMessage classes for to implementing the playMessage method.
11. Develop a abstract Reservation class which has Reserve abstract method. Implement the sub-classes like ReserveTrain and ReserveBus classes and implement the same.
12. Develop an Interest interface which contains simpleInterest and compInterest methods and static final field of Rate 25%. Write a class to implement those methods.
13. Develop a Library interface which has drawbook(), returnbook() (with fine), checkstatus() and reservebook() methods. All the methods tagged with public.
14. Develop an Employee class which implements the Comparable and Cloneable interfaces. Implement the sorting of persons (based on name in alphabetical). Also implement the shallow copy (for name and age) and deep copy (for DateOfJoining).
15. Explain the different methods supported in Object class with example.
16. Explain the methods supported in Class class.
17. Explain the Methods supported in reflect package. Also write a program to implement the reflection of a particular class details like constructors, methods and fields with its modifiers.
18. Develop a static Inner class called Pair which has MinMax method for finding min and max values from the array.
19. What is proxy class? Develop a code for constructing a proxy objects to trace a binary search method with explanations.

1. Explain the classes under 2D shapes.
2. Explain event handling with examples.
3. Explain action event with an example.
4. What are the swing components. Explain.
5. Describe the AWT event hierarchy.

1. Explain generic classes and methods.
2. Explain exception hierarchy.
3. What are the advantages of Generic Programming?
4. Explain the different ways to handle exceptions.
5. How Java handle overflows and underflows?

1. Explain the different states of a thread.
2. Explain thread synchronization with examples.
3. Explain the algorithm used for thread scheduling.
4. Describe multi threading.
5. Explain Deadlocks.

Источник

And contrast java with

  1. Explain OOP Principles.
  2. Explain the features of Java Language.
  3. Compare and Contrast Java with C.
  4. Compare and Contrast Java with C++.
  5. Explain Constructors with examples.
  6. Explain the methods available under String and String Buffer Class.
  7. Explain the Date Class methods with examples.
  8. Discuss in detail the access specifiers available in Java.
  9. Explain the different visibility controls and also compare with each of them.
  10. Explain the different methods in java.Util.Arrays class with example.
  11. Explain Packages in detail.
  12. Discuss the methods under Array Class.
  13. Discuss some of the classes available under Lang package.
  14. Illustrate with examples: static and final.
  15. Explain method overriding with example program.
  16. What is javaDoc? Explain the comments for classes, methods, fields and link.
  17. Application Programs in Java.
  1. Define Inheritance
  2. What are the types of inheritance?
  3. How is multiple inheritance achieved in java?
  4. What is the use of super keyword?
  5. What are object wrappers? Give example.
  6. What is Inheritance Hierarchy?
  7. Differentiate overloading and overriding.
  8. Define polymorphism.
  9. Differentiate static binding and dynamic binding.
  10. When will a class be declared as final?
  11. When will a method be declared final?
  12. What is an abstract class?
  13. What is the need for abstract classes?
  14. Explain about protected visibility control.
  15. What are the methods under «object» class / java.lang.Object.
  16. Explain toString method of object class.
  17. What is reflection?
  18. What are the uses of reflection in Java.
  19. How will you create an instance of Class.
  20. What are the methods under reflection used to analyze the capabilities of classes?
  21. How to create arrays dynamically using reflection package.
  22. Define an interface.
  23. What is the need for an interface?
  24. What are the properties of an interface?
  25. Differentiate Abstract classes and interface.
  26. What is object cloning?
  27. Differentiate cloning and copying.
  28. Differentiate shallow copy and deep copy in cloning.
  29. Does Inheritance removes any fields/or methods of super class?
  30. Mention the use of final keyword.
  31. What is nested class? Mention its types.
  32. What is inner class?
  33. What is the need for inner classes?
  34. What are the rules for inner class?
  35. What is local inner class and anonymous inner class? Give their advantages.
  36. Write the advantages and disadvantages of static nested class.
  37. Define proxies.
  38. Write the application of proxies.
  39. What are the properties of proxy classes?
  1. Explain the concept of inheritance and its types.
  2. Explain the concept of overriding with examples.
  3. What is dynamic binding? Explain with example.
  4. Explain the uses of reflection with examples.
  5. Define an interface. Explain with example.
  6. Explain the methods under “object” class and “class” class.
  7. What is object cloning? Explain deep copy and shallow copy with examples.
  8. Explain static nested class and inner class with examples.
  9. With an example explain proxies.
  10. Develop a message abstract class which contains playMessage abstract method. Write a different sub-classes like TextMessage, VoiceMessage and FaxMessage classes for to implementing the playMessage method.
  11. Develop a abstract Reservation class which has Reserve abstract method. Implement the sub-classes like ReserveTrain and ReserveBus classes and implement the same.
  12. Develop an Interest interface which contains simpleInterest and compInterest methods and static final field of Rate 25%. Write a class to implement those methods.
  13. Develop a Library interface which has drawbook(), returnbook() (with fine), checkstatus() and reservebook() methods. All the methods tagged with public.
  14. Develop an Employee class which implements the Comparable and Cloneable interfaces. Implement the sorting of persons (based on name in alphabetical). Also implement the shallow copy (for name and age) and deep copy (for DateOfJoining).
  15. Explain the different methods supported in Object class with example.
  16. Explain the methods supported in Class class.
  17. Explain the Methods supported in reflect package. Also write a program to implement the reflection of a particular class details like constructors, methods and fields with its modifiers.
  18. Develop a static Inner class called Pair which has MinMax method for finding min and max values from the array.
  19. What is proxy class? Develop a code for constructing a proxy objects to trace a binary search method with explanations.
  1. Draw the inheritance hierarchy for the frame and component classes in AWT and Swing.
  2. What are the advantages of using swing over awt?
  3. How do achieve special fonts for your text? Give example.
  4. Give the syntax of drawImage() and copyArea() methods.
  5. What is Adapter class?
  6. Draw the AWT event Hierarchy.
  7. What are the swing components?
  8. What are the methods under Action Interface.
  9. What are the methods under WindowListener Interface.
  10. What is the difference between Swing and AWT?

Источник

Оцените статью