Final-String-CommandLine Args - Java
Final
It is a keyword to finalize the data(constant). It is like c++ const.
Ex:-
final int a=10;
Furtherly a cannot be modify because a is final variable.
WRITE A PROGRAM TO FIND THE ARRAY LENGTH.
class Samp
{
public static void main(String args[])
{
int a[]=new int[10];
int b[]={10,20,30};
int c[]={5,6,7,8,9,10};
System.out.println("Length of a="+a.length);
System.out.println("Length of b="+b.length);
System.out.println("Length of c="+c.length);
}
}
PROGRAM ON STRING CLASS.
class Samp
{
public static void main(String args[])
{
String S1="Welcome";
String S2="Vision";
String S3=S1+"To"+S2;
System.out.println(S2);
System.out.println(S3);
}
}
WRITE A PROGRAM ON COMMAND LINE ARGUMENTS.
class Sample
{
public static void main(String args[])
{
for(int i=0;i<args.length;i++)
{
System.out.println(args[i]);
}
}
}
For
Online Classes
Contact Us: 9885348743
Online Classes
Contact Us: 9885348743