Java GUI Framework Question:

Does Swing is thread safe? What do you mean by swing is not thread-safe?

Tweet Share WhatsApp

Answer:

This swing interview questions is getting very popular now days. Though it’s pretty basic many developer doesn't understand thread-safety issue in Swing. Since Swing components are not thread-safe it means you can not update these components in any thread other than Event-Driven-Thread. If you do so you will get unexpected behavior. Some time interviewer will also ask what are thread-safe methods in swing which can be safely called from any thread only few like repaint() and revalidate().

Download Java GUI Framework PDF Read All 28 Java GUI Framework Questions
Previous QuestionNext Question
What is Event-Driven-Thread (EDT) in Swing?What are differences between Swing and AWT?