Coding Notes For Automation
Coding Notes For Automation
-----------------------------------------------------------------------------------
---
byte age;
age = 25;
short marks;
marks = 900;
System.out.println(age);
System.out.println(marks);
System.out.println(salary);
System.out.println("Turnover "+turnover);
-----------------------------------------------------------------------------------
----
Real Numbers
-----------------------------------------------------------------------------------
---
float x = 1.00000142f;
double y = 10.25d;
double z = 20.50;
System.out.println(x);
System.out.println(y);
System.out.println(z);
-----------------------------------------------------------------------------------
---
Boolean
-----------------------------------------------------------------------------------
---
boolean isworking;
isworking = true;
System.out.println(isworking);
-----------------------------------------------------------------------------------
---
Character
-----------------------------------------------------------------------------------
---
char gender;
gender = 'M';
System.out.println(gender);
-----------------------------------------------------------------------------------
----
Counting No. of chars in a String using : length()
-----------------------------------------------------------------------------------
--
-----------------------------------------------------------------------------------
--
Capturing char present at specified position using : charAt()
-----------------------------------------------------------------------------------
--
-----------------------------------------------------------------------------------
----
Converting a String to LowerCase and UpperCase using : toLowerCase() and
toUpperCase()
-----------------------------------------------------------------------------------
-----
System.out.println(str.toLowerCase());
System.out.println(str.toUpperCase());
-----------------------------------------------------------------------------------
--
Comparing two Strings using : equals()
-----------------------------------------------------------------------------------
--
String exptitle,acttitle;
exptitle = "Google";
acttitle = "google";
System.out.println(exptitle.equals(acttitle));
output : false
-----------------------------------------------------------------------------------
-
Comparing two Strings using : equalsIgnoreCase()
-----------------------------------------------------------------------------------
-
String exptitle,acttitle;
exptitle = "Google";
acttitle = "google";
System.out.println(exptitle.equalsIgnoreCase(acttitle));
output : true
-----------------------------------------------------------------------------------
--
Checking a String contains another String or not using : contains()
-----------------------------------------------------------------------------------
---
String expurl,acturl;
expurl = "gmail";
acturl = "https://www.google.com/intl/en-GB/gmail/about/";
System.out.println(acturl.contains(expurl));
output: true
-----------------------------------------------------------------------------------
----