Overclock.net banner

Java Help

649 Views 14 Replies 8 Participants Last post by  Djibrille
I Need help with this. Its supposed to give me a multiplication table

Quote:


public static void main(String[] args) {
// Print Header
System.out.println("Multiplication Table:");

for(int i = 0; i <= 10; i++)
{
for(int j = 0; j <= 10; j++)
{
System.out.print( (j * 1) + "\");
}

System.out.println("");
}
}

}

This is the results.
run:
Multiplication Table:

Quote:


0 1 2 3 4 5 6 7 8 9 10
0 1 2 3 4 5 6 7 8 9 10
0 1 2 3 4 5 6 7 8 9 10
0 1 2 3 4 5 6 7 8 9 10
0 1 2 3 4 5 6 7 8 9 10
0 1 2 3 4 5 6 7 8 9 10
0 1 2 3 4 5 6 7 8 9 10
0 1 2 3 4 5 6 7 8 9 10
0 1 2 3 4 5 6 7 8 9 10
0 1 2 3 4 5 6 7 8 9 10
0 1 2 3 4 5 6 7 8 9 10
BUILD SUCCESSFUL (total time: 0 seconds)

See less See more
1 - 15 of 15 Posts
So...what are you trying to do. What is the needed output?
I need it to be a multiplication table of 1 through 10

0 0 0 0 0 0 0 0 0 0 0
0 1 2 3 4 5 6 7 8 9 10
0 2 4 6 8 10 12 16 18 20
0 3 6 9 12 15 18 21 24 27 30
0
0
0 And So Forth
0
0
0
Code:
Code:
public class Multiply {

/**
 * @param args
 */
public static void main(String[] args) {
System.out.println("Multiplication Table:");

for(int i = 0; i <= 10; i++)
{
for(int j = 0; j <= 10; j++)
System.out.print( (j * i) + "\");

System.out.println("");
}

}

}
See less See more
it didnt work, you forgot the put the forward slash by the t but now it does. Thatnks. What did i do wrong
I forgot the forums strip out the character. You have j*1. It should be j*i
3
Quote:


Originally Posted by decompiled
View Post

I forgot the forums strip out the character. You has j*1. It should be j*i

Nice

I was trying to figure out just for kicks and I didn't see that at first. First year programming in Java
See less See more
3
Quote:


Originally Posted by crashnburn_819
View Post

Nice

I was trying to figure out just for kicks and I didn't see that at first. First year programming in Java


You would have found it I bet! I've been making these mistakes long enough now that I pick em out pretty fast LOL
See less See more
Quote:


Originally Posted by decompiled
View Post

You would have found it I bet! I've been making these mistakes long enough now that I pick em out pretty fast LOL

Worst part of Java is my professor has tests on paper. I can't compile on that!
See less See more
That sucks! Are you writing the AP exam...we have 5 questions worth at least 10 marks coding on paper
See less See more
Quote:

Originally Posted by crashnburn_819 View Post
Worst part of Java is my professor has tests on paper. I can't compile on that!
You should work on debugging your code in your head. It's an extremely valuable skill and helps you write better code the first time. Something I've been trying to get better at myself.
See less See more
Quote:


Originally Posted by crashnburn_819
View Post

Worst part of Java is my professor has tests on paper. I can't compile on that!

Same here. Don't they do that everywhere?
See less See more
2
Quote:


Originally Posted by Coma
View Post

Same here. Don't they do that everywhere?

Yep
See less See more
Why would you want to make an exe from java code you would lose the portability that way.Java was created so that you can run the same .class file on different OS-es(eg: Xp, Vista, Linux even OS2) as long as you have the Java virtual machine installed.
But if you really want to make an executable I beleive there are some utilities that can do that, just google for it.And no, Netbeans won't help you do that.
1 - 15 of 15 Posts
This is an older thread, you may not receive a response, and could be reviving an old thread. Please consider creating a new thread.
Top