Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [Java]Tab.length
sky993
post
Post #1





Grupa: Zarejestrowani
Postów: 33
Pomógł: 0
Dołączył: 21.07.2011

Ostrzeżenie: (0%)
-----


Witam. Otoz mam taki maly kodzik

import java.util.*;


public class cos{
public static void main(String[] args)
{
int[] tab=new int[100];

for(int i=0;i<10;i++)
{
tab[i]=i;
}
System.out.println(tab.length);

char[] sl=new char[100];
String s="dasdasd";
sl=s.toCharArray();
System.out.println(sl.length);
}
}

Dlaczego poprzez tab.length dla tablicy int wypisuje 100 a dla char 7 chociaz obydwie byly deklarowane na 100 miejsc?
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 24.08.2025 - 10:02