This question already has answers here:
"implements Runnable" vs "extends Thread" in Java
(42 answers)
Java-Thread Vs Runnable [duplicate]
(3 answers)
Closed 12 days ago.
This post was edited and submitted for review 12 days ago and failed to reopen the post:
Original close reason(s) were not resolved
When in either case of Thread creation we know we are ultimately creating a thread object then , how is it possible that the extends thread way of creating thread lets us use predefined methods such as getName or setName , but using the runnable way- we cannot ? I am unable to understand the difference between both ?
Related
This question already has answers here:
Understanding annotation in Java
(3 answers)
What do annotations do? And how do I use it? [duplicate]
(2 answers)
Closed 7 months ago.
The community reviewed whether to reopen this question 7 months ago and left it closed:
Original close reason(s) were not resolved
I mean I know that it provides metadata and special instructions to the compiler but where is the logic for that? How are two annotations different if both of them has same body? The source code for #Id, #Override and #Embeddable is same but how do they work differently when they don't have any code in them. Also, if we can't see the code/logic then how can I create my own annotation with specific functionality?
This question already has answers here:
What does it mean to "program to an interface"?
(33 answers)
Java - declaring from Interface type instead of Class
(7 answers)
Closed 11 months ago.
Set set= new TreeSet<>();
vs
TreeSet set= new TreeSet<>();
I know we are using the concept of run time polymorphism here, but what is the use of writing this? Is there any advantage to writing one thing over another? both are giving me the correct results. I am learning java right now, help would be great.
This question already has answers here:
Difference between object and instance
(15 answers)
The difference between Classes, Objects, and Instances
(16 answers)
What is the difference between object and instance?
(10 answers)
Closed 3 years ago.
Is instance and object same thing in OOP or not?
A good explanation Here. But some explanation is so confusing.
I want to know best explanation. Advance thanks .
This question already has answers here:
How come an abstract class "DocumentBuilderFactory" allowed to instantiate new instance
(4 answers)
Constructors vs Factory Methods [closed]
(10 answers)
Closed 4 years ago.
I am doing some Java homework and we are currently studying IO and files in java.
In the directions it asks for us to instantiate a filesystem class. However this doesn't seem possible without using the following syntax. How can I better understand this?
FileSystem fs = FileSystems.getDefault();
Thanks for any help.
This question already has answers here:
Class or variable not found
(2 answers)
Should Javadoc comments be added to the implementation?
(7 answers)
Closed 5 years ago.
I'm creating the javadoc of my project, but i'm not sure where should i write it.
I have all the javaDoc implemented in my interfaces. And I have classes implementing these interfaces (and not adding extra-methods). So, Is there any command to copy the javadoc from the interfaces to my classes? Or should i Copy-paste from my interfaces to the implementation?