revision
Thu Sep 05 2024 20:41:16 GMT+0000 (Coordinated Universal Time)
Saved by @ronak
/*
package com.company;
public class revision01 {
public static void main(String[] args) {
System.out.println("Hello World..!!");
}
}
*/
/*
// pgm to understand util package..
package com.company;
import java.util.*;
class revsion01 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
int sum = a+b;
System.out.println("Sum of a & b is :- "+ sum);
}
}
*/
/*
//Pgm to wish Radhey Radhey..
package com.company;
import java.util.*;
class revsion01 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String a=sc.nextLine();
System.out.println("Radhey Radhey "+a+"..!!");
}
}
*/
/*
//Modoulus ka concept and RHS me Float likhna is important..
package com.company;
import java.util.*;
class revsion01 {
public static void main(String[] args) {
int a = 47;
int b=22;
float c = a/b;
float c1 = (float) a/b;
float d = a%b;
int e = (int)a%b;
System.out.println(c);
System.out.println(c1);
System.out.println(d);
System.out.println(e);
}
}
*/
/*
//pgm to print Ronak in hindi
package com.company;
public class revision01 {
public static void main(String[] args) {
}
}
*/
/*
//Math.sqrt pgm
package com.company;
import java.util.*;
class revsion01 {
public static void main(String[] args) {
System.out.println("Enter 3 side of triangle..");
Scanner sc = new Scanner(System.in);
int s1 = sc.nextInt();
int s2 = sc.nextInt();
int s3 = sc.nextInt();
float s = (float)1/2*(s1+s2+s3);
double ar;
ar = Math.sqrt(s*(s-s1)*(s-s2)*(s-s3));
System.out.println("Area is "+ar);
}
}
*/
/*
//quadratic equations...
package com.company;
import java.util.*;
import java.lang.Math;
public class revision01 {
public static void main(String[] args) {
float a,b,c;
double r1,r2;
Scanner sc = new Scanner(System.in);
System.out.println("Enter a , b , c");
a=sc.nextFloat();
b=sc.nextFloat();
c=sc.nextFloat();
System.out.println("Your Qud. Eq. is "+a+"x^2 + "+b+"x + "+c);
System.out.println("Root are...");
r1=(-b+Math.sqrt(b*b-4*a*c))/(2*a);
r2=(-b-Math.sqrt(b*b-4*a*c))/(2*a);
System.out.println(r1);
System.out.println(r2);
}
}
*/
/*
//Icreament Decreament
package com.company;
public class revision01 {
public static void main(String[] args) {
int a=2,b=5,x=4,c,d;
c=a*++x +b; //15
// d= a*x++ +b; //13
System.out.println(c);
// System.out.println(d);
}
}
*/
//String chpter pura..
package com.company;
public class revision01 {
public static void main(String[] args) {
System.out.println("Hello We Are Studying String..!!");
// Print wali backchodi..
int x = 10,y =20;
System.out.println(x+y+"Sum"); //30Sum
System.out.println("Sum "+x+y); //sum 1020
System.out.println("Sum "+ (x+y)); // sum 30
float z =1.2f;
char c = 'A';
System.out.printf("The value of %d %f %c is \n",x,z,c); //See printf from
//Flag
int x1 =-5;
System.out.printf("%5d\n",x);
System.out.printf("%05d\n",x);
System.out.printf("%(5d\n",x);
System.out.printf("%+5d\n",x1);
float a=14.564f;
System.out.printf("%6.2f\n",a); // 14.56
System.out.printf("%1.2f\n",a); //14.56 aage k no. per limits nahi laga sakte..
// heap pool wala concept ye hai ki referenceses aalag hote hai..
//Methords deklo guyzz..
String str = " Java " ;
String str1 = str.toLowerCase();
System.out.println(str1);
String str2 = str.toUpperCase();
System.out.println(str2);
String str3 =str.trim();
System.out.println(str3);
String str4 = str.substring(1,3);
System.out.println(str4);
String str5 =str.replace('a','k');
System.out.println(str5);
String str6 ="www.ronak.com";
System.out.println(str6.startsWith("w"));
// baki k orr hai..
//abhi k lia Questions ker lete hai..
//find the email is on email or not..!!
String strg = "ronak@gmail.comn";
int i = strg.indexOf("@");
String uname = strg.substring(0,i);
System.out.println(uname);
int j = strg.length();
//String domain = str.substring(i+1, 16);
// System.out.println(domain);
// user name or domain bata dia to
// check weather its on gmail or not
// System.out.println(domain.startsWith("gmail"));
// check no. is binary or not..
int b =0110100;
int b1 =014000;
String s1 = b+"";
String s2 = b+"";
System.out.println(s1.matches("[01]+"));
System.out.println(s2.matches("[01]*"));
String s3 ="C12545A";
String s4 ="Z45451A";
System.out.println(s3.matches("[0-9][A-F]+"));
System.out.println(s4.matches("[0-9][A-F]+"));
String d = "01/02/2001";
//System.out.println(d.matches("[0-9][0-9/[0-9][0-9]/[0-9]{4}"));
// Remove speacial character
//remove extra space
//find no. of words in the String..
}
}



Comments