• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Quick Java Question

That wins the award for the most vague question ever. At least those trying to get others to do their homework try to ask a lucid question.
 
like let's say the user enters 3 for the number of sides they want on a square...then I need to make it look like this:

***
***
***
 
stick it in a loop....

like write a method:

public class test{
public static void main(String[]args){

int i = 4;
printSquare(i);
}

public static void printSquare(int i){
for(int k=0; k<i; k++){
for(int j = 0; j<i; j++){
System.out.print("*");
}
System.out.println();
}
}
}
 
Originally posted by: RaynorWolfcastle
oh boy, if you can't figure this out on your own, programming may not be your thing.

oh you don't even understand, my teacher has taught nothing all school year so far and all of a sudden he's expecfting us to know how to write methods and stuff, I am trying to learn it though
 
get the number
print 4 times an * then at the end of that loop, put numTimes++;
prints that crap 4 times again
again
and again
ALL inside one big ass loop which stops when numTimes = input
 
Objects Have Class! by David Poplawski is a good intro Java book. That's what we use... he's actually an instructor here. Haven't you had a good teacher that you wish taught every class? heh
 
Originally posted by: RaynorWolfcastle
oh boy, if you can't figure this out on your own, programming may not be your thing.

seriously. this should be known after sitting through lecture 1 of programming 101.
 
Back
Top