Monday, 28 September 2015

Program to print Strings and Integers from an array


public class Arry {
public static void main(String args[])
{
int ar[] = {1,2,3,4,5};
String str[] = {"Sai","Nagendra","Bhavani","Prasad","Battipati"};
for (int i=0;i<5;i++){
System.out.println("The value of the elements are " +ar[i]);
System.out.println("The value of the elements are " +str[i]);
}
}
}

Out put :-

The value of the elements are 1
The value of the elements are Sai
The value of the elements are 2
The value of the elements are Nagendra
The value of the elements are 3
The value of the elements are Bhavani
The value of the elements are 4
The value of the elements are Prasad
The value of the elements are 5
The value of the elements are Battipati

No comments:

Post a Comment