This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
    Bookmark Topic Watch Topic
  • New Topic

can we overriding static method  RSS feed

 
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
Posts: 66207
151
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
Posts: 66207
151
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
Boost this thread!