Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Help ! merge this code into 1 main method . ASAP :( tnx

  1. #1
    Junior Member
    Join Date
    Nov 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Help ! merge this code into 1 main method . ASAP :( tnx

    public class twoDarray1 {
        static int[][] tableArray = new int[3][];
        public static void main(String[] args) {
        tableArray[0] = new int[3];
        tableArray[1] = new int[4];
        tableArray[2] = new int[5];
        for(int i = 0; i<3; i++)
        		fillArray(i,i+3);
        System.out.println();
        }
        public static void fillArray(int row, int col){
        	for (int i=0; i<col; i++)
        		tableArray[row][i] = i;
        	for (int i = 0; i<col; i++)
        		System.out.print(tableArray[row][i]+ "\t");
        	System.out.println(" ");
        }
     }
    Last edited by JavaPF; November 23rd, 2011 at 11:52 AM. Reason: Use highlight tags!


  2. #2
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default Re: Help ! merge this code into 1 main method . ASAP :( tnx

    Why?
    No homework.

  3. #3
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: Help ! merge this code into 1 main method . ASAP :( tnx

    Not a good start. This is so easy I'm surprised you haven't even attempted it.
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

Similar Threads

  1. [SOLVED] Can someone help me with this code asap
    By Darkcore123 in forum What's Wrong With My Code?
    Replies: 12
    Last Post: November 14th, 2011, 11:55 AM
  2. Need some help with this code - Asap
    By Th3T3chGuy in forum What's Wrong With My Code?
    Replies: 3
    Last Post: November 10th, 2011, 07:17 AM
  3. Replies: 3
    Last Post: October 31st, 2011, 12:42 AM
  4. How do I call a method from the main method?
    By JavaStudent1988 in forum Java Theory & Questions
    Replies: 5
    Last Post: October 19th, 2011, 08:37 PM
  5. adding main method to a code
    By IDK12 in forum What's Wrong With My Code?
    Replies: 5
    Last Post: August 31st, 2009, 08:52 PM