473,569 Members | 3,035 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Multplication table

2 New Member
hi,i write a code for multiplication table,it is compiled properly but it is showing run time error.i think there is some problm in declaring array.i cant fix it.plz help me out with this..i am a beginner in java.

My code is
class Multiplication
{

public static void main (String[] a)
{
int num = Integer.parseIn t(a[0]);

for( int i=1;i<=10;i++)
System.out.prin tln(i*num);
}

}

Error is :
Exception in thread "main" java.lang.Array IndexOutOfBound sException: 0 at Multiplication. main(Main.java: 6)
Jun 7 '10 #1
3 2330
jkmyoung
2,057 Recognized Expert Top Contributor
How are you running the program?
I suggest putting a debug statement like:
System.out.prin tln("The number is "+a[0]);
as the first line of your main function.

Normally the first argument is the name of the program.
Jun 7 '10 #2
varund
2 New Member
Hello jkmyoung,

I tried to insert the command,it goes correct while compiling,and the same error repeating me in the run time.
i am trying to compile the program by javac Multiplication. java and then java Multiplication.

i cant get it,can u edit the code and tell the procedure,what is the mistake i am doing..
Jun 7 '10 #3
jkmyoung
2,057 Recognized Expert Top Contributor
Ok. Your program is receiving an empty argument list.
You have to pass in the argument like:
java Multiplication 100

I would suggest checking if there is an argument to begin with, eg:
Expand|Select|Wrap|Line Numbers
  1.   if (a.length < 1){
  2.     System.err.println("Usage: java Multiplication [number]");
  3.     return;
  4.   }
  5. }
Jun 7 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
6587
by: Gaz | last post by:
Hi, I need to have a table nested within another table. The tables are alongside each other visually speaking, and the nested table (on the right) can vary in size. My problem is that when the nested table has more rows than the first table, the first table (on the left) pads out its rows so that the table matches the height of the nested...
10
7833
by: John | last post by:
I have a table with two rows. On the first row is a text box and in the second row is an image. I have set the table cellpadding to 0 and cellspacing to 0. The table is leaving extra spaces in the rows on the top and bottom of the picture and image. I need to make the height of the rows to be the same as the textbox and image. How do I do...
61
24420
by: Toby Austin | last post by:
I'm trying to replace <table>s with <div>s as much as possible. However, I can't figure out how to do the following… <table> <tr> <td valign="top" width="100%">some data that will 'stretch'</td> <td valign="top" width="300">some data that won't 'stetch'</td> </tr> </table>
9
2756
by: Ed_No_Spam_Please_Weber | last post by:
Hello All & Thanks in advance for your help! Background: 1) tblT_Documents is the primary parent transaction table that has 10 fields and about 250,000 rows 2) There are 9 child tables with each having 3 fields each, their own PK; the FK back to the parent table; and the unique data for that table. There is a one to many relation...
9
33420
by: Wang, Jay | last post by:
I try to group several rows in a table into a div and show/hide them by click on a button somewhere with a javascript link. When clicked, the link will toggle the style of the div section's style between BLOCK and NONE. This technique works on normal text fine, but it doesn't work on part of the table, is there a solution that I can achieve...
4
3283
by: jeffsal | last post by:
I am using sorttable.js to sort a table which works fine which allows a user to sort the table by clicking on the column header. Is there some code I could add to the page (onload or something) to auto sort by the first column without user clicking on it. Here is the sorttable.js code. addEvent(window, "load", sortables_init); var...
2
7777
by: steventhrasher42 | last post by:
I can't figure out a way to possibly make this work in HTML. I have a table embedded in another table, with the inner table spanning a few columns. I would like for the outer table to span the width of the page. The problem is that the 2nd row that contains the colspan'ed cell with the inner table in it is wider than it needs to be (there's...
7
4806
by: Kamal | last post by:
Hello all, I have a very simple html table with collapsible rows and sorting capabilities. The collapsible row is hidden with css rule (display:none). When one clicks in the left of the expandable row, the hidden row is made visible with css. The problem is when i sort the rows, the hidden rows get sorted as well which i don't want and want...
5
3828
by: wugon.net | last post by:
question: db2 LUW V8 UNION ALL with table function month() have bad query performance Env: db2 LUW V8 + FP14 Problem : We have history data from 2005/01/01 ~ 2007/05/xx in single big table, we try separate this big table into twelve tables and create a view
5
4916
by: jrod11 | last post by:
hi, I found a jquery html table sorting code i have implemented. I am trying to figure out how to edit how many colums there are, but every time i remove code that I think controls how many colums there are, it crashes. There are currently 6 columns, and I only want 4. How do I remove the last two (discount and date)? Here is a link:...
0
7619
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8138
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7681
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7983
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6290
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5514
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
1
2118
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1229
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
950
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.