HAY THANK FOR VISIT
Question:-Write a program to print a sreing array and print the largest.
class lar
{
void main(String s[])
{
int l=0;
String lar=s[0];
for(int i=1;i<s.length;i++)
{
l=s[i].length();
if(l>lar.length())
{
lar=s[i];
}
}
System.out.println("longest string is"+lar);
}
}
Question:-Write a program to print a sreing array and print the largest.
class lar
{
void main(String s[])
{
int l=0;
String lar=s[0];
for(int i=1;i<s.length;i++)
{
l=s[i].length();
if(l>lar.length())
{
lar=s[i];
}
}
System.out.println("longest string is"+lar);
}
}
No comments:
Post a Comment
HAY THAKYOU FOE VISIT