
Untitled
By: a guest on
Aug 12th, 2012 | syntax:
None | size: 1.05 KB | hits: 9 | expires: Never
Cannot make a static reference to the non-static method fxn(int) from the type Two [closed]
class Two {
public static void main(String[] args) {
int x = 0;
System.out.println("x = " + x);
x = fxn(x);
System.out.println("x = " + x);
}
int fxn(int y) {
y = 5;
return y;
}
}
public static int fxn(int y) {
y = 5;
return y;
}
Two two = new Two();
x = two.fxn(x);
...
Two two = new Two();
x = two.fxn(x)
...
public class Two {
public static void main(String[] args) {
int x = 0;
System.out.println("x = " + x);
x = fxn(x);
System.out.println("x = " + x);
}
static int fxn(int y) {
y = 5;
return y;
}
public class A
{
public int fxn(int y) {
y = 5;
return y;
}
}
class Two {
public static void main(String[] args) {
int x = 0;
A a = new A();
System.out.println("x = " + x);
x = a.fxn(x);
System.out.println("x = " + x);
}