0
Explain??
static int cube(int a) { return a*a*a; } And why if i use System. out.println in the method body and call it through the main there a error???And can't we use System. out.println when return type is Int??? Any why is return a*a*a; used?? is it compulsory?? and y only return is used?
4 Respuestas
+ 6
Could you post example code, please?
+ 6
What you describe should work, so there are two possibilities:
a) There is something else wrong with your code.
b) I don't understand your question.
Complete code would help to figure out, if ( (a==true) || (b==true) ). Please publish it at the playground, if possible.
+ 2
public class Lati
{
public int cube(int a)
{
return (a*a*a);
}
}
class Prin
{
public static void main (String[] args)
{
Lati figura1 = new Lati();
int area = figura1.cube(5);
System.out.println(area);
}
}
I have the same problem of Tashi N, i hope this code can help you to resolve the problem.
if is possible post your code for more details.
+ 1
its the starting part @Tashi N