Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
    Bookmark Topic Watch Topic
  • New Topic

can we overriding static method

 
Pawan M
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi,
I was reading queries posted by other so i got one doubt due to following sentences that
"You can "override" a non-final static method, although this is actually redefining it and hiding the original method."

but what i know that we can not override static method.
Am i correct or not,please clear my doubt? i have also created one program
class OverridenStaticMeth {

static void printValue() {

System.out.println("Overriden Meth");
}

}

public class OverrideStaticMeth extends OverridenStaticMeth {

public static void main(String[] args) {

OverridenStaticMeth osm = new OverrideStaticMeth();

osm.printValue();

}

static void printValue() {

System.out.println("Overriding Meth");
}

}
but i am getting output-Overriden Meth
so where its overriding?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64631
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
"Pawan M", please check your private messages for an important administrative matter.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64631
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please take the time to choose the correct forum for your posts. This forum is for questions on Tomcat.

This post has been moved to a more appropriate forum.
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Report post to moderator
It turns out we've already got a copy of this, here. Pawan, please don't post the same question in more than one forum, as it wastes people's time when they respond to one without realizing it's been answered elsewhere.
 
    Bookmark Topic Watch Topic
  • New Topic