Program4
package exceptionHandling;
public class EH4
{
public static void main(String[] args)
{
int a[] = {10,20,30};
// 0 1 2
System.out.println(a[0]); //10
System.out.println(a[1]); //20
System.out.println(a[2]); //30
//run time exception
//unchecked exception
try //????
{
//problem line
System.out.println(a[3]);
}
catch(Exception e)
{
//solution
System.out.println("index 3 element is not present in
array");
System.out.println("change the value of index");
}
//exception--just bring the program in normal flow
System.out.println("hiii");
System.out.println("hello");
System.out.println("bye");
}
}
Program5
package exceptionHandling;
public class EH5
{
public static void main(String[] args)
{
int a = 100;
int b = 0;
//run time
//unchecked
try
{
int c = a/b;
System.out.println(c);
}
catch(Exception e)
{
System.out.println("divide by zero to any value not
possible");
System.out.println("change the value of b var");
}
//indepedent code
//No exception --still this code should run
//exception --still this code should run
finally
{
System.out.println("Hii");
System.out.println(1+1);
}
System.out.println("end of program");
}
}
//int range -->NO infinity
//double range --> Infinity
Program6
package exceptionHandling;
public class EH6
{
public static void main(String[] args)
{
System.out.println("Hiii RAHUL");
//forcefully execption throw
throw new ArithmeticException();
}
}
API
Sprint routine
Swagger
Retest-regression
How to configure the pom.xml file?
Steps
1. Open pom.xml file
2. Before </project> end add <dependencies> opening
and </dependencies> closing tag as follows.
3. Under this <dependencies> tag add <dependencies>
as per the libraries requirements.
4.How to add dependency for each library such as
selenium webdriver for selenium, TestNg for test
classes, Apache library for excel etc.
A. Search on google maven repository
B. And go to https://mvnrepository.com/
C.Over there search required library for such as
selenium webdriver –for selenium
TestNG for eclipse
D.Find the latest and stable version (refer max
used version by users)
E.After clicking on it copy the Maven code and
paste it in the pom.xml file of our project
and do the same for rest of the dependencies
and paste it there.
F.After adding all the dependencies save pom.xml
file and give some time (3-4 min) to configure
those libraries to project.
G.And after some time that libraries will be get
configured to the project and we can see those
and also execute the require code now.
• How to create Maven Project??
1. Go to File New Project click Maven Project
2. Select Maven Project and Next button
3. Click on create simple project and next button
4. Enter GroupID and ArtifactID as same as the project name and
click finish.
5. New project will appear in the project explorer.
https://github.com/
STEP-A –Login Process
1. Sign Up
2. Use EmailId
3. Create password
4. Enter username
5. And follow the process and complete the login process
6. Always use “free account”
*******************************************************************
******
STEP-B - After Login
1. On home page Click on start project
2. Give Repository Name mark access as public click on create
repository
3. The new repository will be created and copy its link
Step 4: Go to eclipse and right click on the project which we wants to push over
the git server and select team --- share project.
Step 5: Click on the share project click on the check box of below dialogue box
and click on the project check box as well and click on create repository and click
on finish.
Step 6: to commit the project right click on project --- Team--- commit
Step 7: Write down the message for the commit process and click on commit.
Step 8: To push code Right click on project --- Team--- push.
Step 9: Paste the url from the git into the URI path and enter the username into
the field.
Step 10: Generate the personal access token from git account that has to be used
for password.
Step-To generate the token:
1. click on the profile avatar and select settings:
2. Click on developer setting:
3. Click on personal access token and select all entities present over there.
4. Click on generate new token.
5. After the generation of new token copy the token right click on the project—
Team—Push to branch master:
Paste the url and enter the username of git and personal access token as
password followed by click on secure storage check box.
Click on the preview button and click on Push.
Clone/Import a git project into eclipse:
1. Go to file and import
2. Click on git and projects from git
3. Click on next and click on “Existing local repository”
4. Select the project u want to import or pull into eclipse
5. Click on next, next and finish and check ur project is properly came into
eclipse or not.