Given a sample code:
public class Sample {
public static void outcome(short a) {
System.out.print("short ");
}
public static void outcome(Long a) {
System.out.print("LONG ");
}
public static void main(String[] args) {
short shortVar = 1;
long longVar = 109002;
outcome(shortVar);
outcome(longVar);
}}
What will happen when you compile and run the above give sample code?
1) Compile time error
2) Compile and print "short long"
3) Compile and output of null
4) Compiles but gives Runtime Exception
(2)
It will compile and run successfully there is no issue of using the static method here.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.