java array object
Class obj[]= new Class[array_length]
java array object
Class obj[]= new Class[array_length]
Java Array objects
class Police
{
public int id;
public String name;
Police(int id, String name)
{
this.id = id;
this.name = name;
}
}
class PoliceClass
{
public static void main (String[] args)
{
Police[] array;
array = new Police[4];
array[0] = new Police(3242,"Peter");
array[1] = new Police(4353,"Adil");
array[2] = new Police(6433,"Preet");
array[3] = new Police(3434,"Ranjeet");
for (int i = 0; i < array.length; i++)
System.out.println("Police array Element at " + i + " : " +
array[i].id +" "+ array[i].name);
}
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us