• +91 9723535972
  • info@interviewmaterial.com

Java Interview Questions and Answers

Question - Can you declare a class as private?

Answer - Yes, we can declare a private class as an inner class. For example, class MyPrivate { private static class MyKey { String key = "12345"; } public static void main(String[] args) { System.out.println(new MyKey().key);//prints 12345 } }

Comment(S)

Show all Coment

Leave a Comment




NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners