Jump to content

simple Logic to learn Array in java

- - - - -

  • Please log in to reply
4 replies to this topic

#1
kellyyy

kellyyy

    Newbie

  • Members
  • Pip
  • 1 posts
public class MultiArrayDirect{

    public static void main(String[] args){

        char[][] nilai = new char[3][2];

        nilai[0][0] = 'A';

        nilai[0][1] = 'B';

        nilai[1][0] = 'F';

        nilai[1][1] = 'D';

        nilai[2][0] = 'A';

        nilai[2][1] = 'C';

        

        for(int a=0; a<3; a++){

            for(int b=0; b<1; b++){

                System.out.println(nilai[a][b]);

            }

        }

                         

    }

}


:cool:

Edited by ZekeDragon, 22 February 2011 - 02:23 PM.
Please use [CODE] tags (the # button) when posting code.


#2
lethalwire

lethalwire

    while(false){ ... }

  • Members
  • PipPipPipPipPipPipPip
  • 748 posts
  • Programming Language:Java, PHP
  • Learning:Java, PHP
What's the question?

#3
mnirahd

mnirahd

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 330 posts
Hi,

It looks like a simple but perfect example of using an array in JAVA.
Thanks for sharing ;)

-Munir

#4
Roman Y

Roman Y

    Programmer

  • Members
  • PipPipPipPip
  • 189 posts
On the other hand (can't try it out myself I'm on a smartphone killing time while on a bus) is ot going to print letters or the ASCII numbers of them because of the single quotes?

#5
An Alien

An Alien

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 260 posts
Thanks, that helped me a bit. But I think this should go in tutorials.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users