UrbanPro

Learn Java Training from the Best Tutors

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

Search in

What will be the output of the program? class s implements Runnable { int x, y; public void run() { for(int i = 0; i < 1000; i++) synchronized(this) { x = 12; y = 12; } System.out.print(x + " " + y + " "); } public static void main(String args[]) { s run = new s(); Thread t1 = new Thread(run); Thread t2 = new Thread(run); t1.start(); t2.start(); } } A. Dead Lock B.It print 12 12 12 12 C.Compilation Error D.Cannot determine output.

Asked by Last Modified  

13 Answers

Learn Java

Follow 0
Answer

Please enter your answer

B. is the answer
Comments

Core Java, Angular 2/4/6, J2EE, Spring Boot

Option B is the answer
Comments

Certified Developer Sales force And Mule Soft.

B. It print 12 12 12 12
Comments

Diploma in electronic engineering

code is not following java style coding.Not willing to go in
Comments

Learn Java Technologies from basic to latest, English Speaking, Memory Techniques

Answer is D
Comments

Java Professional

The Answer is B. It prints 12 12 12 12 The two threads created with run, execute the print statement and prints the x and y value twice.
Comments

Experience in Java and Android Trainer.

It print 12 12 12 12
Comments

JAVA,JDBC,SERVLETS,JSP,STRUTS,SPRNG,HIBERNATE

B
Comments

Computer Science And Maths Tutor

a
Comments

Java/J2EE, B.E./B.Tech/MCA SubjectsTraining

B
Comments

View 11 more Answers

Related Questions

How can in prepare for competitive programming in Java ? Any person or Institute who Teaches ? HELP !
If you are already a java programmer and wanted to increase your logical skills and compete somebody then you have to practice writing various logics so that you will become strong in java programming....
Ajay
Why do many software engineers not like Java?
Opinions on programming languages can vary, but some software engineers may express dissatisfaction with Java for reasons such as perceived verbosity, boilerplate code, and a slower pace of language evolution...
Guruprasad
0 0
5
What are the best books for learning programming languages like C (except let us C), Java, Python, etc.?
you can read "Head First Java",I do read it even now after having 6 years of working experience in Java when I want to refresh some concept. you can also read Core Java, Volume 1 and 2 by Cay S. Horstmann,...
Shashank
0 0
6
Presently is swings and applets are important in java ?
Yes for standalone application development
Mahender

Now ask question in any of the 1000+ Categories, and get Answers from Tutors and Trainers on UrbanPro.com

Ask a Question

Related Lessons

Advance Java
1) Servlet • Basics of Servlet • Servlet Request • Servlet Collaboration • Servlet Config • Servlet Context • Attribute • Session Tracking • Event and Listener •...
A

Introduction to Course Content
Video about what we are going to learn throughout the Java Training Session .

Java Overview
Java platform overview Java platform components The Java platform consists of the following components. The Java language Like any programming language, the Java language has its own structure, syntax...
A

Akshay Shende

0 0
0

Use of Service Locator Pattern
If we want to reuse the java code that should be the best approach w.r.t re-usability, maintanence and saving time to concentrate on our own businbess logic/requirement. In the similar approach many patterns...
M

Priority in TestNG
public class Priority { @Test (priority=1)public void login() {System.out.println("login");} @Testpublic void email1() {System.out.println("email1");} @Test (priority=-2)public void email2() {System.out.println("email2");} //I...
S

Sarthak C.

0 0
0

Recommended Articles

Java is the most commonly used popular programming language for the creation of web applications and platform today. Integrated Cloud Applications and Platform Services Oracle says, “Java developers worldwide has over 9 million and runs approximately 3 billion mobile phones”.  Right from its first implication as java 1.0...

Read full article >

In the domain of Information Technology, there is always a lot to learn and implement. However, some technologies have a relatively higher demand than the rest of the others. So here are some popular IT courses for the present and upcoming future: Cloud Computing Cloud Computing is a computing technique which is used...

Read full article >

Java is the most famous programming language till date. 20 years is a big time for any programming language to survive and gain strength. Java has been proved to be one of the most reliable programming languages for networked computers. source:techcentral.com Java was developed to pertain over the Internet. Over...

Read full article >

Designed in a flexible and user-friendly demeanor, Java is the most commonly used programming language for the creation of web applications and platform. It allows developers to “write once, run anywhere” (WORA). It is general-purpose, a high-level programming language developed by Sun Microsystem. Initially known as an...

Read full article >

Looking for Java Training Classes?

Learn from the Best Tutors on UrbanPro

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you
X

Looking for Java Training Classes?

The best tutors for Java Training Classes are on UrbanPro

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

Learn Java Training with the Best Tutors

The best Tutors for Java Training 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