+ 2
Can somebody fix this code for me pleasei .......get this error;illegal static declaration in inner class Mine
package ian; public class cudi { void ian(String j){ System.out.println(j); } int g,v; int ian(int h,int k){ h=g; k=v; int c=g/v; {System.out.println(c);} } class Mine{ public static void main(String args[]){ cudi bn=new cudi(); bn.ian("ian"); bn.ian(56,8); } } }
11 Respostas
+ 7
//Can somebody fix this code for me pleasei .......get this error;illegal static declaration in inner class Mine
//Code Fixed
//package ian; This line causes an error
public class cudi
{
void ian(String j){
System.out.println(j);
}
int g,v;
void ian(int h,int k){
g= h; //not h=g;
v= k; //not k=v; else you will have division by zero error
int c=g/v;
{//This curly brace not necessary
System.out.println(c);}
}//This curly brace also not necessary
}
class Mine
{
public static void main(String args[]){
cudi bn=new cudi();
bn.ian("ian");
bn.ian(56,8);
}
}
+ 5
Copy my code and use it like that or try to match mine. Better yet put ur code in playground and put the link here
+ 4
Did u modify my code?
+ 4
Alrighty
+ 4
What IDE are u using?
+ 2
Thanks bruh....but my compiler prints out the same error message
+ 1
i made changes to existing code
+ 1
the code is okay....my compiler is bewitched 😂😂it says class cudi is public and should be declared in a file named cudi.java
+ 1
//Can somebody fix this code for me pleasei .......get this error;illegal static declaration in inner class Mine
//Code Fixed
//package ian; This line causes an error
//public//if i delete this it works class cudi
{
void ian(String j){
System.out.println(j);
}
int g,v;
void ian(int h,int k){
g= h; //not h=g;
v= k; //not k=v; else you will have division by zero error
int c=g/v;
{//This curly brace not necessary
System.out.println(c);}
}//This curly brace also not necessary
}
class Mine
{
public static void main(String args[]){
cudi bn=new cudi();
bn.ian("ian");
bn.ian(56,8);
}
}
+ 1
Sorry......its cppdroid
0
Java n IDE android app