Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tut]Java Array Name
18-04-2012, 12:19 AM,
Post: #1
[Tut]Java Array Name
ok Ni pulak mcm mana Array Baca Char lak

Info Seblum memahami koding
class <-- mesti huruf kecil.
Name class <--- mesti huruf Besar di depan
char <-- knp pakai char knp dia tak pakai int ? sbb dalam koding ni nak pakai Huruf. {'R','U','B','I','A'};
System.out.print(stud_name[i]); <-- knp dalam System.out.print ni ada [i] ..
ahahhaha ni la namanya array..



Code:
class Array_Name
{
public static void main(String args[])
{
  char stud_name[]={'R','U','B','I','A'};
  for(int i=0;i<=4;i++)
     System.out.print(stud_name[i]);
}    


[b]OUTPUT [/b]

RUBIA  <--- NI output dia..

aku nak terangkan mcm mana eh knp ada [i].. hurmm.... takpe buat dulu koding nanti paham la hahwhahwaw
}
[Image: logo.png]
Reply
18-04-2012, 01:31 AM,
Post: #2
RE: [Tut]Java Array Name
atau boleh juga dengan cara berikut

Code:
class Array_Name
{
  public static void main(String[] args)
  {
    char stud_name[]={'R','U','B','I','A'};
    
    for(int i = 0; i < stud_name.length; i++)
      System.out.print(stud_name[i] );
  }
}

atau

Code:
class Array_Name
{
  public static void main(String[] args)
  {
    String stud_name = "RUBIA";
    
    for(int i = 0; i < stud_name.length(); i++)
      System.out.print(stud_name.charAt(i) );
  }
}

(18-04-2012, 12:19 AM)Ujang Wrote: ok Ni pulak mcm mana Array Baca Char lak

Info Seblum memahami koding
class <-- mesti huruf kecil.
Name class <--- mesti huruf Besar di depan
char <-- knp pakai char knp dia tak pakai int ? sbb dalam koding ni nak pakai Huruf. {'R','U','B','I','A'};
System.out.print(stud_name[i]); <-- knp dalam System.out.print ni ada [i] ..
ahahhaha ni la namanya array..



Code:
class Array_Name
{
public static void main(String args[])
{
  char stud_name[]={'R','U','B','I','A'};
  for(int i=0;i<=4;i++)
     System.out.print(stud_name[i]);
}    


[b]OUTPUT [/b]

RUBIA  <--- NI output dia..

aku nak terangkan mcm mana eh knp ada [i].. hurmm.... takpe buat dulu koding nanti paham la hahwhahwaw
}
Reply
19-04-2012, 03:07 PM,
Post: #3
RE: [Tut]Java Array Name
(18-04-2012, 12:19 AM)Ujang Wrote: ok Ni pulak mcm mana Array Baca Char lak

Info Seblum memahami koding
class <-- mesti huruf kecil.
Name class <--- mesti huruf Besar di depan
char <-- knp pakai char knp dia tak pakai int ? sbb dalam koding ni nak pakai Huruf. {'R','U','B','I','A'};
System.out.print(stud_name[i]); <-- knp dalam System.out.print ni ada [i] ..
ahahhaha ni la namanya array..



Code:
class Array_Name
{
public static void main(String args[])
{
  char stud_name[]={'R','U','B','I','A'};
  for(int i=0;i<=4;i++)
     System.out.print(stud_name[i]);
}    


[b]OUTPUT [/b]

RUBIA  <--- NI output dia..

aku nak terangkan mcm mana eh knp ada [i].. hurmm.... takpe buat dulu koding nanti paham la hahwhahwaw
}

ujang ni macam budak poli aku plak....coding macm lab aku
Angry

sharing your knowledge to grow your knowledge...

and the knowledge is life not death
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Soalan Java darknite 10 805 27-11-2013, 01:47 PM
Last Post: darknite
  [help] i need idea on how put my 2D array in best first search algo Timon 5 1,006 28-05-2013, 07:12 PM
Last Post: linear
  soalan java. hard3 4 919 10-05-2013, 10:33 PM
Last Post: JejakaPemalu
  [help] inputfile java please click me to know more Timon 0 394 14-04-2013, 10:02 PM
Last Post: Timon
  [problem]with java tcp client and server chat pron3t 1 555 26-02-2013, 01:21 PM
Last Post: muhaznar
  java API Timon 3 827 09-12-2012, 09:58 PM
Last Post: lamki
  java background music library Timon 0 444 09-12-2012, 05:21 PM
Last Post: Timon
  JAVA Layout... mana 1 feveret :P 127001 7 1,676 03-12-2012, 10:32 AM
Last Post: Wushipher
  Java | MS Excell 127001 5 1,040 29-07-2012, 12:41 AM
Last Post: lamki
  Tutorial: Menghubungkan SQLite Dengan Java s3m00t 4 1,290 25-07-2012, 02:40 AM
Last Post: s3m00t

Forum Jump: