UrbanPro
true

Learn Selenium from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

doWhile example in Java

S
Sarthak C.
18/11/2021 0 0

public class doWhilePracticleEx {

public void test() {

}

public static void main(String args[]) {

String q1 = "Who is PM of India?";
String a1 = "Sonia Gandhi";
String a2 = "Rahul Gandhi";
String a3 = "Amit Shah";
String a4 = "Narendra Modi";


System.out.println(q1);
System.out.println(a1);
System.out.println(a2);
System.out.println(a3);
System.out.println(a4);
String user="";

int attemptCount=1; //no of attempts

do {
if(attemptCount==1) {
System.out.println("Enter Your answer");
}
Scanner sc = new Scanner(System.in);
//control + shift+ o
user = sc.nextLine();
attemptCount++;


} while(!user.equalsIgnoreCase(a4));
System.out.println("Your answer is correct!!!!!");
}

}

0 Dislike
Follow 1

Please Enter a comment

Submit

Other Lessons for You

Importance of Constructor's Visibility.
While developing program or implementing Singleton pattern we have learnt to mention constructor as private and known reason is -> to blocked its direct call from outside of class. But did we think...
M

Difference between driver.close() and driver.quit () method
close () -By using this command, we can close the current browser or page. quit() - By using this command, we can shut down the web driver instance or destroy the web driver instance(Close all the windows).

JAVA Online Training
What is Java? Java is a technology developed by James Gosling at Sun Microsystems, Sun Microsystems is now a part of Oracle Corporation. This is one of the most powerful & securable language used to...

TestNG
TestNG Concepts TestNG: TestNG is an automation framework to run the test cases, test suites and do parallel testing. It is an advanced version of Junit. It consists of many features like annotations,...

Wait Handler implementation in WebDriver
public void waitForElementPresence(By by) { Wait<WebDriver> wait = new WebDriverWait(driver, GLOBAL_TIME_OUT); wait.until(ExpectedConditions.presenceOfElementLocated(by)); } ...
X

Looking for Selenium Classes?

The best tutors for Selenium Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn Selenium with the Best Tutors

The best Tutors for Selenium Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more