MajorGeeks Support Forums

Go Back   MajorGeeks Support Forums > ----------= PC, Desktop and Laptop Support =---------- > Software
Register FAQ Members List Calendar Casino Mark Forums Read

Software Software such as operating systems like Windows XP, Windows Vista, Windows 7 etc., or specific programs.


Reply
 
Thread Tools Display Modes
  #1  
Old 06-08-12, 10:58
erdy_rezki erdy_rezki is offline
Private E-2
 
Join Date: Apr 2012
Location: indonesia
Posts: 9
Thanks: 1
Thanked 0 Times in 0 Posts
Default not statement and expected, where error position?

class ArrayUnequalInt2DToy {
public static void main(String args []){
int int2UnequalArr [][]= new int[4][];
int 2DUnequalArr[0]= new int[1];
int 2DUnequalArr[1]= new int[2];
int 2DUnequalArr[2]= new int[3];
int 2DUnequalArr[3]= new int[4];
int k=0;
for (int i=0;i<4;i++) {
for (int j=0;j<i+1;j++){
int2DUnequalArr [i][j] = k++;
}
for (int i=0;i<4;i++){
for (int j=0;j<i+1;j++){
System.out.print(int2DUnequalArr[i][j] +" ");

}
System.out.println();
}
}
}
Reply With Quote
Sponsored links
  #2  
Old 06-08-12, 21:42
PC-XT's Avatar
PC-XT PC-XT is offline
Master Sergeant
 
Join Date: Oct 2007
Location: on a farm
Posts: 645
Thanks: 27
Thanked 80 Times in 74 Posts
Post Re: not statement and expected, where error position?

You used 3 different names for the same int array. Edits commented:
Code:
class ArrayUnequalInt2DToy {
	public static void main(String args []){
		int int2DUnequalArr [][]= new int[4][];//the D was missing
		int2DUnequalArr[0]= new int[1];//detached type prefix
		int2DUnequalArr[1]= new int[2];//ditto
		int2DUnequalArr[2]= new int[3];//ditto
		int2DUnequalArr[3]= new int[4];//ditto
		int k=0;
		for (int i=0;i<4;i++) {
			for (int j=0;j<i+1;j++){
				int2DUnequalArr [i][j] = k++;
				}
				for (int i=0;i<4;i++){
					for (int j=0;j<i+1;j++){
				System.out.print(int2DUnequalArr[i][j] +" ");		
						
					}
				System.out.println();
				}
			}
		}
__________________
I.think(code);
I.eat(code.spaghetti);

Last edited by PC-XT; 06-08-12 at 21:48..
Reply With Quote
  #3  
Old 06-09-12, 06:42
erdy_rezki erdy_rezki is offline
Private E-2
 
Join Date: Apr 2012
Location: indonesia
Posts: 9
Thanks: 1
Thanked 0 Times in 0 Posts
Default Re: not statement and expected, where error position?

thanks very much for ur help bro
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Java ";" expected error slashgonewylde Software 4 10-20-09 09:56
What You Played, What You Expected, and What You Got Roguefighter15 Software 5 10-01-09 08:46
help for loop statement jenritz2k3 Software 1 09-18-08 18:56
Error Object Expected jearbearantiques Software 2 05-13-08 07:58
Annoying IE script error - object expected... rquig Software 1 01-28-07 13:42


All times are GMT -5. The time now is 00:56.

MajorGeeks.Com Menu

MajorGeeks.Com \ All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ NEW! PC Games \ System Tools \ Macintosh \ Demonews.Com \ Top Downloads

MajorGeeks.Com \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds


All content Copyright MajorGeeks.com source code Powered by vBulletin® Version 3.8.4
Copyright © 2009 vBulletin Solutions, Inc. All rights reserved.
Ad Management by RedTyger