Two Laptop Bag*
The moose likes Beginning Java and the fly likes can we overriding static method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic
Author

can we overriding static method

Pawan M
Greenhorn

Joined: Feb 23, 2008
Posts: 3
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

Joined: Jan 10, 2002
Posts: 60063
    
  65

"Pawan M", please check your private messages for an important administrative matter.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60063
    
  65

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

Joined: Jan 30, 2000
Posts: 18671
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.


"I'm not back." - Bill Harding, Twister
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: can we overriding static method
 
Similar Threads
Doubt in Overloading
Small OO doubt
doubt var arg
Generics doubt
Can we override static method