Learn Selenium from the Best Tutors

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

Search in

doWhile example in Java

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";

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();

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


0 Dislike
Follow 1

Please Enter a comment


Other Lessons for You

Is Automation The Software Testing Miracle Cure?
The technology community is a big fan of automation. From DevOps’ continuous delivery roots to enterprises’ automatic business processes, automation is a trademark of the business world and...

Anshika S. | 18/02/2017

0 0

Facebook Analytics
Assume how the Facebook application will store the millions of customer's record in real-time: facebook = { 'jose': { 'name': 'jose', 'age': 33, 'hobby': , # cricket,football 'mobile': 1111111111, 'email':...

Logeswaran | 03/09/2019

0 0

Selenium waits
In Selenium web driver, the biggest challenge is to synchronize your script with the Web application under test. To make this synchronization work, we have concept of waits. Although we can use Thread.sleep()...

Pratibha T. | 25/02/2022

0 0

Java Advantages
In this video, learn about Java and its advantages. Also, check out the difference between Java and C++, Java development kit, Java Run Time Environment (JRE) with a proper demonstration program for better clarity.

Ranjit Singh | 06/07/2021

0 0

Java8 Filters and collectors
Lets say we have collection of strings and we would like to filter (remove) out certain strings from collection. We could achive the same in java 7 and earlier versions import java.util.ArrayList; import...

Shiva Kumar | 10/10/2018

0 0

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

Book a Free Demo

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

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