static-methods tag

5 questions


1 answers
155 views
0
Why doesn't Java allow static method override?

Why can't I override the static method in Java?If possible, show me an example of how to do it.


1 answers
71 views
0
Is there any way to call the getClass() method in the static method?

I made a lot of static methods. Inside the static method, you need to call the getClass() method as shown below public static void startMusic() { URL songPath = getClass().getClassLoader().getResource...

2 years ago

1 answers
139 views
0
Cannot make a static reference to the non-static method

I'm creating a multilingual program in Java. An error occurs when inserting R.string data from an XML file as a string value. public static final String TTT = (String) getText(R.string.TTT);The error ...


1 answers
104 views
0
Why can't you create static methods in an abstract class?

abstract class foo { abstract void bar(); // <-- Pig abstract static void bar2(); //<-- No}Why can't you define a static method for an abstract class like above?


1 answers
74 views
0
When do you use the static method?

I have a question. When do you use the static method? I made the getters and setters methods. I want to make these methods callable only when an object is created. But do I have to use a static method...

2 years ago

© 2024 OneMinuteCode. All rights reserved.