Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


mahendra
static code problem
1 Answer(s)      4 years and a month ago
Posted in : Java Interview Questions


do we overload or override static methods if possible please give me the example

Advertisement
View Answers

August 10, 2010 at 1:34 PM


Hi Friend,

Yes, you can overload and override static methods but only with static methods.

For ex.

public class AB
{
public static void main(String args[])
{
method();
method(8);
}
public static void method()
{
System.out.println("Hello");
}
public static void method(int i)

{
System.out.println(i);
}
}

Thanks




Related Tutorials/Questions & Answers:
static code problem - Java Interview Questions
static code problem  do we overload or override static methods... and override static methods but only with static methods. For ex. public class AB { public static void main(String args[]) { method(); method(8
What are the restriction imposed on a static method or a static block of code?
What are the restriction imposed on a static method or a static block of code?  hi, What are the restriction imposed on a static method or a static block of code? Thanks
Advertisements
problem of static in jsp page by multiple user access
problem of static in jsp page by multiple user access  hi , i am continuing my online exam project,but i have a Singleton class which i am invoking from my jsp page , ths page can access by more number of users .every user
static
Static Concept  in what are all the situation we may use static concepts   if we need to execute class level one time execution code,then use static blocks and without creation of object we need to perform some task
STATIC
STATIC  WHAT IS STATIC BLOCK?EXPLAIN , AND WHAT IS THE DIFFERENCE BETWEEN STATIC BLOCK AND STATIC METHOD?   A STATIC block is automatically... between static block and static method: static block will execute when ever
static
static  what r the main uses of static in java   Hi Friend, The Static means that a certain object/variable is resident in memory and accessed each time an instance of a class, an object, is created. When static
static
static  What is the exact need of declaring a variable as static?   A static variable is a variable who's single copy in memory is shared by all objects,so any modifications to the static variable will modify it's value
Static
Static  Can i know the real time example for Static method and final variables with defenition? Thank you
static
redeclare static variable in the inherited class  can we redeclare static variable in the inherited class like this: public class StaticClass1 { class StaticClass1{ static int noOfInstances; StaticClass1
Problem with code - Java Beginners
Problem with code  Hi Deepak. Im a newbie here at your forum. I have got a simple code of mine which is having a little problem. When I compile it, i.... public class LoopArguments { public static void main(String []args
code problem - Java Beginners
code problem  Dear sir, I'm havin a problem that suppose i've got... java script j2ee j2me sql plz help me to sort out this problem. thnx   Hi Friend, Please try the following sample code to solve your problem
code problem - Java Beginners
of program. thnx  Hi friend, Code to help in solving the problem : import java.util.*; class TotalArList { public static void main(String...code problem  Dear sir, I've some integer value in ArrayList like
code problem - Java Beginners
code problem  Dear sir, my problem is given below: suppose a file...; Hi friend, Code to help in solving the problem : import java.io.*; class FileRead { public static void main(String args[]) { try
code problem - Java Beginners
.  Hi friend, Code to help in solving the problem : public class EncryptString { public static void main(String arg[]) { try...code problem  Dear sir, I've some string called "JohnSon" that has
code problem - Java Beginners
code problem  Dear sir, I have an excel file in D: drive called today.xls, i want to open it thru java program, what code would be compatible plz help me  Hi friend, Code to help in solving the problem : import
code problem - Java Beginners
; Hi friend, Code to help in solving the problem : import java.io.*; class FileRead { public static void main(String args[]) { try...code problem  Dear Sir, I've to make a program where there are 10
code problem:ajax - Ajax
code problem:ajax  Hi,I am using ajax to populate a select box.for this I am writing out.write("ONE"); like that.it runs fine in firefox.bt not in IE.Can anyone help me out this... thanks
code problem - Java Beginners
code problem  My code is below: import java.io.*; class FileRead { public static void main(String args[]) { try{ InputStreamReader input...()); } } } Dear sir, my problem is that suppose i enter line number: 3 if line
Hibernate code problem - Hibernate
Hibernate code problem  Hi, This is Birendra Pradhan.I want... in the DAO.Can it be possibe. Please send some sample code.. thanks & Regards Birendra  Hi friend, For solving the problem visit
problem with code - Ajax
problem with code  hi friends i am sending a code in that when we... to use ajax i wrote the code of jsp and the remaning code by using ajax is not wrritened by observing these below code please try the remainning ajax code its
code problem - Java Beginners
code problem  Dear sir, my problem is that I've a string value if this String value has "quit" then output should be "bye". i want to make this program using SWITCH CASE statement. how to implement String value in Switch plz
code problem - Java Beginners
code problem  Dear sir, My problem is that i have some string value and in some case i want to remove all the value of this string, i tried this code- Response.str.clear(); but it shows some error called "response package
hibernate code problem - Hibernate
/selectclause.shtml If you have any problem this send me detail and source code...hibernate code problem  suppose i want to fetch a row from the table through a value which i got from the jsp page. how can i do it and iterate
Hibernate code problem - Hibernate
problem please send me code. Visit for more information. http...Hibernate code problem  Hi This is Raju.I tried the first example........How can i solve this problem. Am i need to Kept any other jars in path. 
code problem - Java Beginners
code problem  Dear sir, my question was actually how to find a particual line's contain, example if a file contains- hy, how r u? regrd, john... your problem in details. Which keyword search the line. Thanks
code problem - Java Beginners
code problem  I want to write a program that read a string and prints... of space charaters Here is the code which I suppose is almost correct.However... import java.util.*; public class Q2_sheet11 { static Scanner console=new
code problem - Java Beginners
code problem  Dear sir, my problem is that, i have two Combobox one.... plz tell how to code this program.   Hi Friend, You can use the following code: ComboBox var arr = new Array(); arr[0] = new
Application context problem code
Application context problem code   now i am posting my code here . i..."); // code to set test action environment createAction("/create", "Test", "list"); // code to execute test action String result = proxy.execute(); // code
code problem - Struts
code problem  hi friends i have 1 doubt regarding how to write the code of opensheet in action class i have done it as the action class code...(); System.out.println(conn); //Code to generate new sheet i.e login time IS NULL
code problem - Java Beginners
code problem  Dear sir, i'm making a program where characters of a string are being displayed having its length thru a loop, like- s a t i s... { public static void main(String[] args) { String str = "satish
Code Problem - Applet
Code Problem  How to set a background color for frame and panel... SetBackgroundColor{ public static void main(String[]args){ JFrame f=new JFrame... class SetBackgroundColor{ public static void main(String[]args){ JFrame f=new
 

 

 

DMCA.com