static-methods tag

5 questions


1 answers
145 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
66 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
128 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
98 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
69 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.