Possible Duplicate:
Is there a ‘new’ modifier for methods in Java?
In c#, a subclass's method can be modified as new.
One usage of the new modifier to explicitly hide a member inherited from a base class.
Is there a same keyword in Java?
Java provides 4 levels of access modifiers. This means that you can modify access to a variable, method or a class in 4 ways. These 4 ways are private, public, protected and default.
short answer is NO (but you can achieve it some how and i will tell)!! internal in C# is actually an "assembly-private" modifier. what is an assembly ? there is not any exact equivalent for internal in java.
For final methods, use the sealed modifier. When you use sealed modifiers in C# on a method, then the method loses its capabilities of overriding. The sealed method should be part of a derived class and the method must be an overridden method.
Two objects from the same class will have the same fields, constructors, and methods. Suppose we created a new Rectangle object, setting the length to 5 and the width to 10. If we call, or invoke, the area() method, the result will be 50 (length times width). This is an internal method call.
No.
In C# you use new to hide / shadow non-virtual functions of a base class. You need this keyword in C#, because you can not override functions that are non-virtual.
In Java, all functions are virtual by default, hence you can always override them and there is no need for a keyword such as new.
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With