Simple_interest_in_cmd_line_argument

class Simple_interest_in_cmd_line_argument
{
public static void main(String args[])
{
{
if (args.length==3)
{
int p =Integer.parseInt(args[0]);
int r =Integer.parseInt(args[1]);
int t =Integer.parseInt(args[2]);
float i = (p*r*t)/100;
System.out.println(i);
}
else{
System.out.println("wrong input");
}
}
}
}

Stringhandling in java

class Stringhandling {
public static void main(String args[])
{
String s ="I LOVE LOVE";
System.out.println(s);//DISPLY THE STRING
System.out.println(s.length());// DISPLAY NO. OF CHAR
System.out.println(s.toUpperCase());//CONVERSION TO CAPITAL LETTERS
System.out.println(s.toLowerCase());//CONVERSION TO SMALLER LETTERS
System.out.println(s.startsWith("i"));//CHECKING STRING WHERTHER IT START WITH I OR NOT(CASE SENSITIVE)
System.out.println(s.endsWith("I"));//CHECK STRING END WITH I OR NT CASE-SENSITIVE
System.out.println(s.replace('O','h'));//REPLACE 'O' TO 'h' (CASE -SENSITIVE)
System.out.println(s.trim());//REMOVE UNUSED SPACES FROM CORNER
System.out.println(s.indexOf('O'));//DISPLAY POSITION OF CHARACTER FROM BEGINNING
System.out.println(s.lastIndexOf('O'));//DISPLAY POSITION OF CHARACTER FROM BEGINNING & IF CHAR NOT PRESENT THEN ANS= -1.
System.out.println(s.charAt(7));//DISPLAY CHAR WHICH IS AT 7th POSITION FROM BEGINNING
System.out.println(s.substring(2));// DISPLAY CHARACTER FROM 2nd POSITION TO LAST
System.out.println(s.substring(2,7));//DISPLAY CHARACTER FROM 2nd position to 7th where counting start from zero position(ANS LOVE)
String s2 ="I LOVE love";
System.out.println(s.startsWith(s2));// CHECK FROM BEGINNING TO END THE MATCH OF EACH WORD (here ans false 'coz case does not match)
System.out.println(s.equals(s2));//COMPARE ALL CHARACTER (CASE SENSITIVE)
System.out.println(s.equalsIgnoreCase(s2));// COMPARE BUT NOT CASE-SENSITIVE
}
}

While_Use_for_generating_Table_Of_2

class While_Use_Table_Of_2
{
public static void main(String args[])
{
int i=0;
while(i<20)
{
i=i+2;
System.out.println(i);
}
}
}
/**@first initialisation
**@use of while condition
**@ need curly braces
**@ w small letter
*/

Program to find factorial of any no

import java.util.Scanner;
public class factorial_of_any_no
{
public static void main(String args[])
{
int fa=1;
Scanner sc =new Scanner(System.in);
System.out.println("enter the no");
int n=sc.nextInt();
if(n<0)
System.out.println("not defined");
else
{
for(int i=1;i<=n;i++)
{
fa=fa*i;
}
System.out.println(fa);
}
}
}

Another method

import java.util.Scanner;
class Factorial_In_Dec_Way
{
public static void main (String args[])
{
Scanner define =new Scanner(System.in);
System.out.println("enter the no for factorial");
int f = define.nextInt();
if(f<0)
{
System.out.println("not defined");
}
else
{
for (int i=(f-1); i>=1; i--)                        //recuursion with function call
{
f=f*i;
}
System.out.println(f);
}
}
}

Array_wise_display_of_alphabates

class Array_wise_display_of_alphabates
{
public static void main(String args[])
{
try
{
String s= args[0];
for(int i=0;i<s.length();i++)
{
System.out.println(s.charAt(i));
}
}
catch(Exception e)
{
System.out.println("catch little little ");
}
}
}