A couple of issues there, the main one being this:
for(int i=1;p=1;i<=4;i++,p++)
// ^ ^ ^
The for
statement consists of three, not four, parts separated with ;
. I suspect you wanted
for(int i=1,p=1;i<=4;i++,p++)
// ^--- comma here
Separately, I believe you have to specify the argument to main
even if you're not using it, so:
public static void main(String[] args)
In a comment on the qustion, cadrian pointed out a further problem:
System.out.print(Math.pow(p,2);
// Missing ) here ------------^