do we overload or override static methods if possible please give me the example
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 Pages:
static code problem - Java Interview Questions staticcode 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
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
Problem
Problem import java.io.*;
import java.net.*;
public class EchoClient
{
public static void main(String[] args) throws IOException...();
stdIn.close();
echoSocket.close();
}
}
this is my code,
compiled
Problem
Problem import java.io.*;
import java.net.*;
public class EchoClient
{
public static void main(String[] args) throws IOException...();
echoSocket.close();
}
}
this is my code,
compiled with no errors, but when running giving
problem
problem import java.io.*;
class ranveer
{
public static void main(String args[])throws IOException
{
BufferedReader in =new BufferedReader(new...;Hi,
What do you want to do with this code. Please clarify
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 - 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
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,
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
code related problem code related problem this code is compiling but not running please help
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public...()==button2)
{
frm.setDefaultCloseOperation(JFrame.EXITONCLOSE);
}
}
}
public static
Java code problem
Java code problem Please check the errors,if any,in this code...i am a java beginner
import java.util.ArrayList;
import java.util.Calendar...
{
/**
* @param args
*/
public static void main(String[] args
PHP Variables Static
disappears, Once the function is finished.
To solve this problem we use PHP static...PHP Variables Static
PHP static variable is used to remember the value... is running a static variable
is only retained by the function , but it is NOT shared
problem in java code - Java Beginners problem in java code In displaying an matrix in normal java code we use two for loops...When i attended an interview.....the hr asked me to display... your requirement
public class DisplayArray {
public static void main
JSP code problem - JSP-Servlet
JSP code problem Hi friends,
I used the following code... is the code:
Display file upload form to the user... totalBytesRead = 0;
//this loop converting the uploaded file into byte code
while
java Code Problem - Java Beginners
java Code Problem Hi Sir.
i am creating one java program in which i want to remove unsed variables from java program and store it into another...;
}
}
class Prog2
{
public static void main(String args[])
{
Prog1 p=new
java code problem - Java Beginners
java code problem i have created a JTable in Class1 now i need...,
Try the following code:
1) ClassA.java
import java.io.*;
import... ClassB
{
public static void main(String arg[]){
try
{
Form frame=new
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
PROBLEM IDENTIFICATION PROBLEM IDENTIFICATION class MOrders
{
int nooforders; // Data...: "+
nooforders);
}
public static void main(String args[])
{
MOrders obj = new MOrders ();
obj.getorder();
obj.displayorders();
}
}
when this code is compliled it shows
Static keyword in public static void main code, as soon as the UseStatic class is loaded, all of the static statements...Static keyword in public static void main Hi,
I have seen that on page mentioned below for static keyword explanation given is:
Page:
http
Applet run with appletviewer but not in browser, any code problem.
Applet run with appletviewer but not in browser, any codeproblem. Hi,My problem is when I am running my applet in appletviewer index.html, Its work... can be problem in code also. please check my code.
1) Card.java
package
Java static method example
Description:
Static variable are used within the static method. Non static
variable do not exits in the static method. Static variables are shared by its
class instances. Static variable can be used without using the instances
StringToenizer Problem
answer to me.
Hi Friend,
Try the following code:
import java.util.*;
class ConvertStringTokenizerToString
{
public static void main(String
how to call static method
how to call static method class A
{
//some code
}
class B extends class A
{
static method()
}
class C
{
}
//how to access static method() from B to C
how to call static method
how to call static method class A
{
//some code
}
class B extends class A
{
static method()
}
class C
{
}
//how to access static method() from B to C
how to call static method
how to call static method class A
{
//some code
}
class B extends class A
{
static method()
}
class C
{
}
//how to access static method() from B to C
how to call static method
how to call static method class A
{
//some code
}
class B extends A
{
static method()
}
class C
{
}
//how to access static method() from B to C
how to call static method
how to call static method class A
{
//some code
}
class B extends A
{
static method()
}
class C
{
}
//how to access static method() from B to C
how to call static method
how to call static method class A
{
//some code
}
class B extends A
{
static method()
}
class C
{
}
//how to access static method() from B to C
jdbc problem
jdbc problem hi my name is mohit...i am making a project in java.......i have made this code in netbeans...i have already entered the values... to
* initialize the form.
* WARNING: Do NOT modify this code. The content
JAVA Problem
for string length
Ignore case
handle boundary conditions
Optimize the code
The given code accepts a word and array of five words which... RemoveFromArray
{
public static void main(String[] args
printout problem
this.
Regards,
am2085
Hi Friend,
Try the following code:
import...(scrollPane);
add(panel);
}
public static void main(String arg[])
{
try
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 Can i know the real time example for Static method and final variables with defenition? Thank you
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
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
code problem:ajax - Ajax codeproblem: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
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