Linked Questions

0 votes
0 answers
74 views

Suppose I have the following simple code: class A { protected int someMethod() { return staticMethod(); } private static int staticMethod() { return 10; } } class B ...
Ahmad's user avatar
  • 13.5k
0 votes
0 answers
56 views

Example from another stackoverflow thread link: public class RegularEmployee { private BigDecimal salary; public void setSalary(BigDecimal salary) { this.salary = salary; } ...
Rik Schaaf's user avatar
  • 1,203
0 votes
0 answers
54 views

I have an abstract Class: public abstract class BaseBean { public static String getTableName(){ return "base"; } } And I have several Classes extending BaseBean, for Example: ...
trapzerapzerix's user avatar
2 votes
0 answers
42 views

I'm beginner to java.I just recently learned about inheritance between classes. I know that if I inherit from a class,I can use those fields and methods,and also the objects I create will have those. ...
Baltatu Andrei Mircea's user avatar
1 vote
0 answers
38 views

class Base { public static void display() { System.out.println("Static or class method from Base"); } public void print() { System.out.println("Non-static or Instance ...
Nitin Singhal's user avatar
-4 votes
1 answer
37 views

Is this method type hiding? How static method gets area in memory? public class Demo { public static final void main(String args[]) { try{ A a = new ...
Maulin Patel's user avatar
0 votes
1 answer
29 views

This is the code that I'm dealing with: class Animal { public void hide() { System.out.println("The hide method in Animal."); } public void override() { System.out....
Dorian Mayorquin's user avatar
2096 votes
41 answers
697k views

What real (i.e. practical) difference exists between a static class and a singleton pattern? Both can be invoked without instantiation, both provide only one "Instance" and neither of them is thread-...
Jorge Córdoba's user avatar
685 votes
29 answers
358k views

The question is in Java why can't I define an abstract static method? for example abstract class foo { abstract void bar( ); // <-- this is ok abstract static void bar2(); //<-- this ...
hhafez's user avatar
  • 39.9k
117 votes
20 answers
310k views

I'd like to know: Why can't static methods be overridden in Java? Can static methods be overloaded in Java?
giri's user avatar
  • 27.3k
224 votes
3 answers
143k views

What's the standard way to call static methods? I can think of using constructor or using the name of the class itself, I don't like the latter since it doesn't feel necessary. Is the former the ...
simonzack's user avatar
  • 21.2k
47 votes
7 answers
20k views

What are the key differences between OO in Smalltalk and Java? Please note that I am a Java programmer trying to expand his horizons by exploring Smalltalk. Currently I know almost nothing about ...
Jim's user avatar
  • 653
74 votes
3 answers
49k views

Referring to the first answer about python's bound and unbound methods here, I have a question: class Test: def method_one(self): print "Called method_one" @staticmethod def ...
Emma's user avatar
  • 55.7k
50 votes
5 answers
12k views

I wrote this program in Java public class Why { public static void test() { System.out.println("Passed"); } public static void main(String[] args) { Why NULL = null; NULL.test(); ...
Artjem's user avatar
  • 511
34 votes
9 answers
35k views

I know that we cannot override static methods in Java, but can someone explain the following code? class A { public static void a() { System.out.println("A.a()"); } } class B ...
user avatar

15 30 50 per page
1
2
3 4 5
7