473,386 Members | 1,796 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Final Static Method ... little bit of confusion about it.

dmjpro
2,476 2GB
i konw that the static methods r not overriden.....right???
i think it is not.

now my confusion is that ... to declare a static method as final ... this is meaning lesss..right???
but the compiler flashes no error.
plz explain me.....


kind regards.
dmjpro.
May 23 '07 #1
5 1997
JosAH
11,448 Expert 8TB
i konw that the static methods r not overriden.....right???
i think it is not.

now my confusion is that ... to declare a static method as final ... this is meaning lesss..right???
but the compiler flashes no error.
plz explain me.....


kind regards.
dmjpro.
If you declare a non-static method as final the method can not be overridden;
if you declare a static method as final the method can not be hidden:
Expand|Select|Wrap|Line Numbers
  1. public class Base {
  2.    public final static void foo() { ... }
  3. }
  4. public class Derived extends Base {
  5.    public static void foo() { ... } // compilation error here
  6. }
kind regards,

Jos
May 23 '07 #2
dmjpro
2,476 2GB
i know what u told.

but my confusion is ..... declaring a static as final ... is it meaningfull???
because to stop override the method is declared as final.
but the static method can't be overridden ... so is it meaningfull???
plz explain.

kind regards.
dmjpro.
May 23 '07 #3
r035198x
13,262 8TB
i konw that the static methods r not overriden.....right???
i think it is not.

now my confusion is that ... to declare a static method as final ... this is meaning lesss..right???
but the compiler flashes no error.
plz explain me.....


kind regards.
dmjpro.
There's a difference between overriding and hiding.
May 23 '07 #4
dmjpro
2,476 2GB
sorry .. could u be more clearer????

kind rergards.
dmjpro.
May 23 '07 #5
JosAH
11,448 Expert 8TB
sorry .. could u be more clearer????

kind rergards.
dmjpro.
Read my code example in my previous reply.

kind regards,

Jos
May 23 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Anthony Baxter | last post by:
To go along with the 2.4a3 release, here's an updated version of the decorator PEP. It describes the state of decorators as they are in 2.4a3. PEP: 318 Title: Decorators for Functions and...
14
by: Medi Montaseri | last post by:
Hi, I think my problem is indeed "how to implement something like java's final in C++" The long version.... I have an abstract base class which is inherited by several concrete classes. I...
3
by: Steven D'Aprano | last post by:
I've been doing a lot of reading about static methods in Python, and I'm not exactly sure what they are useful for or why they were introduced. Here is a typical description of them, this one...
5
by: Chris | last post by:
Hi I have a scenario where I've created another AppDomain to dynamically load a DLL(s) into. In this newly loaded DLL I want to call a static method on a class. The problem arise is that I have...
8
by: Peter B. Steiger | last post by:
The latest project in my ongoing quest to evolve my brain from Pascal to C is a simple word game that involves stringing together random lists of words. In the Pascal version the whole array was...
43
by: Mark | last post by:
Hello Friends Please check the code below. One in C# and other in VB .Net In C# I am not able to access a static property by an instance variable, but in VB I can do it easily. The Error is ...
11
by: toton | last post by:
Hi, I have little confusion about static memory allocation & dynamic allocation for a cluss member. I have class like class Bar{ public: explicit Bar(){ cout<<"bar default"<<endl; }
2
by: Anup Daware | last post by:
Hi Group, I have a little confusion over the use of static class in C#. I have a static method in my static class. This method reads an xml and returns a collection of objects. This collection...
14
by: Jordan Marr | last post by:
I have the following class: class ProvisionCollection { ... private int m_VarianceCount; public int VarianceCount { get { return m_VarianceCount; }
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.