Witam pięknie,
Uczę się javy z podrecznika, w którym jak na razie wszystkie przyklady tworzone sa w szkielecie:
class Main {
public static void main (String args[])
{
}
}
Czytam teraz o tablicach, definiowanie, i w ogole czym to sie je. Niestety nie wiem gdzie umiescic kod np.
{
int tablica[] = new int[100];
tab[100] = 10;
System.out.println("100tny element tablicy ma wartosc " + tablica[100]);
}
w srodowisku BlueJ, w ktorym jestem zmuszony pracowac. Szkielet tego srodowiska zaraz po otwarciu wyglada nastepujaco:
/**
* Write a description of class tablice here.
* @author (your name)
* @version (a version number or a date)
*/
public class tablice
{
// instance variables - replace the example below with your own
private int x;
/**
* Constructor for objects of class tablice
*/
public tablice()
{
// initialise instance variables
x = 0;
}
/**
* An example of a method - replace this comment with your own
* @param y a sample parameter for a method
* @return the sum of x and y
*/
public int sampleMethod(int y)
{
// put your code here
return x + y;
}
}
Prosze o pomoc. Wydaje sie to byc sprawa prosta, ale jestem b. zielony... [???]