Array in java using assignment for String

//assignment for string
class ex_3
{
    public static void main(String[]args)
    {
        int i;
        String n[]={"Sid","Shivam","Anay","Rahul","Trisha"};
        for(i=0;i<5;i++)
        System.out.println(n[i]);
    }
}

output

Sid
Shivam
Anay
Rahul
Trisha

No comments:

Post a Comment

any problem in any program comment:-

Second largest number in java using ternary operator

 //Largest second number using ternary operator public class Main { public static void main(String[] args) { int a=5,b=6,c=7; int ...