How can we use the abstract getScreenSize() method in Toolkit class?

Teapot

Searching on java api document, i found that the getScreenSize() method is an abstract method in the Toolkit class. Now i'm wondering why the code below works.

Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
setLocation((d.width - getWidth())/2,(d.height - getHeight())/2);

if getScreenSize() is abstract, then we shouldn't be able to use it. How does it work?

apetranzilla

Toolkit.getDefaultToolkit will return a subclass of Toolkit which implements getScreenSize() appropriately. It's defined as abstract in Toolkit so that the behavior can be defined separately for different platforms.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How can we identify if a method belongs to an abstract class or an interface?

From Dev

Can we create abstract class without abstract method in php?

From Dev

can I use invoke to abstract class method

From Dev

Why can't we use abstract class instead of interface in WCF?

From Java

Can we instantiate an abstract class?

From Dev

What is the purpose of abstract properties, when we still can use them in our abstract class?

From Dev

How can we use .class on primitive types?

From Dev

how can we use $_POST variable in a class

From Dev

How can we use .class on primitive types?

From Dev

Scenario where we can use abstract class only over interface class in c#

From Dev

Can we create an object of abstract class?

From Dev

Why can't we use this instance in the static method of extended class?

From Dev

How can I access injected Grails beans in an abstract class method?

From Dev

How to call a method in an abstract class

From Dev

How can we call a method inside class in ES7?

From Dev

Java: How to use Abstract class

From Dev

How can we make use of common methods (like log-in method) shared across all the files in unit/test class file?

From Dev

How can we make use of common methods (like log-in method) shared across all the files in unit/test class file?

From Dev

How to refer to an abstract class' method inside a method

From Dev

How can we use One controllers method in other controllers view?

From Dev

why abstract class can have a instance method?

From Dev

How can we use a List from Java class that allow us this

From Dev

Why can't we overload a abstract method in a functional interface? (Java)

From Java

How can a close() method invoked from Stream point to the implementation of the close() method in the AbstractPipeline abstract class?

From Dev

Can we call private methods of abstract class using reflection?

From Dev

Why can't we instantiate an abstract class in Java?

From Dev

Can we Pass Abstract Class Object as Argument Using Polymorphism?

From Dev

Can you use an abstract function in an abstract class in c++?

From Dev

how many variables, how many methods can we write in java class and how many lines of code can we write in java method?

Related Related

  1. 1

    How can we identify if a method belongs to an abstract class or an interface?

  2. 2

    Can we create abstract class without abstract method in php?

  3. 3

    can I use invoke to abstract class method

  4. 4

    Why can't we use abstract class instead of interface in WCF?

  5. 5

    Can we instantiate an abstract class?

  6. 6

    What is the purpose of abstract properties, when we still can use them in our abstract class?

  7. 7

    How can we use .class on primitive types?

  8. 8

    how can we use $_POST variable in a class

  9. 9

    How can we use .class on primitive types?

  10. 10

    Scenario where we can use abstract class only over interface class in c#

  11. 11

    Can we create an object of abstract class?

  12. 12

    Why can't we use this instance in the static method of extended class?

  13. 13

    How can I access injected Grails beans in an abstract class method?

  14. 14

    How to call a method in an abstract class

  15. 15

    How can we call a method inside class in ES7?

  16. 16

    Java: How to use Abstract class

  17. 17

    How can we make use of common methods (like log-in method) shared across all the files in unit/test class file?

  18. 18

    How can we make use of common methods (like log-in method) shared across all the files in unit/test class file?

  19. 19

    How to refer to an abstract class' method inside a method

  20. 20

    How can we use One controllers method in other controllers view?

  21. 21

    why abstract class can have a instance method?

  22. 22

    How can we use a List from Java class that allow us this

  23. 23

    Why can't we overload a abstract method in a functional interface? (Java)

  24. 24

    How can a close() method invoked from Stream point to the implementation of the close() method in the AbstractPipeline abstract class?

  25. 25

    Can we call private methods of abstract class using reflection?

  26. 26

    Why can't we instantiate an abstract class in Java?

  27. 27

    Can we Pass Abstract Class Object as Argument Using Polymorphism?

  28. 28

    Can you use an abstract function in an abstract class in c++?

  29. 29

    how many variables, how many methods can we write in java class and how many lines of code can we write in java method?

HotTag

Archive