Java Beginner



Share on Google+Share on Google+

Ajay Para
Java Beginner
1 Answer(s)      6 years ago
Posted in : Java Interview Questions

can we declare a class inside an interface? where this type of declaration required? give one example

View Answers

November 16, 2011 at 12:51 PM

Yes, classes can be declared inside interfaces. This technique is sometimes used where the class is a constant type, return value or method argument in the interface. When a class is closely associated with the use of an interface it is convenient to declare it in the same compilation unit. This proximity also helps ensure that implementation changes to either are mutually compatible.

A class defined inside an interface is implicitly public static and operates as a top level class. The static modifier does not have the same effect on a nested class as it does with class variables and methods.

A class is defined inside an interface to bind the interface to a TYPE.

public interface A {
    class B {


Related Tutorials/Questions & Answers:
java beginner
java beginner  hai a i'm beginner 2 java... i want to fetch data from database using combo box(drop down list) without using javascript...when i click list(ex:countrys should b selected)selected country should get inserted
Java Beginner
Java Beginner  can we declare a class inside an interface? where this type of declaration required? give one example
java beginner
java beginner  Hi i have a methd that is public static insert ( map p), i have passed a java map object in this method , so i want to store employee infrmation in haspmap and how to find highest salery and afetr public
Java Beginner
Java Beginner  To reverse a every other word in a string. Example :- If the input is "This is a line of message" the output should be "sihT is a line fo message
java beginner
java beginner  Hi using hashcode() and equal() method and hashmap object how to compare employee lastname and firstname ,display in console
java beginner
java beginner  Hi how to sort list of element containing a data object like date of birth of employee. display employee in youngest first and oldest last , using one of the collection class for sorting
java beginner
java beginner  Write a program that will grade the students quiz. The program will ask the user to enter the number of the questions in the quiz, the right answer for each question and save it in array. The program will ask
java beginner
java beginner  HI I am swetha iam confused when to use service(), doget(), dopost() method in servlets   Any request from client are handled initially by the service() method before delegating to the doXxx() methods
jAVA BEGINNER PROBLEMS  I need the program that takes from standard input an expression without left parenthesis and prints the equivalent infix expression with the parenthesis inserted??? Like EXAMPLE: 1+2)3-4)5-6
Java beginner - Java Beginners
Java beginner  what is the diffrence between abstraction and interface? with coding
What is the right compiler for a java beginner?
What is the right compiler for a java beginner?  Hi, Which compiler... for a java beginner? Thanks   Hi, You should use the JDK for compiling... for a java beginner? Thanks
Beginner  how to call a gui class from applet class   Hello Friend, Please visit the following link: Thanks
beginner  provide a simple java exception program that uses try , catch, throw and finally blocks
Tutorial for total beginner in Java
Tutorial for total beginner in Java - Explains the Basics of Java programming language. This is a video tutorial for total beginner in Java. In this video... language. This video is for total beginner in Java which will teach how to create
How a beginner can start Java Programming?
How a beginner can start Java Programming?  I Just have programming knowledge of C & C++. Let's know how I can learn Java? Is there any Java... have programming language of C and C++ then you can learn Java programming
Nag(Beginner)  sir i am new to java.. i want to know what topics comes under core java, adv. java and also the remaining topics... plz tell me   Java Tutorials
Generating Random Numbers to Fill array. Java Beginner needing help!
Generating Random Numbers to Fill array. Java Beginner needing help!  Hello all! I am new to this site, and Java programming. My problem is: Write...() methods. I am new to Java programming and this seems mind blowing to me :( I
Learn Java for beginner
more. One way to learn Java is through online training. Here a beginner in Java...Java is the most used programming language in the world. Java provides... and available to anyone. This is the advantage Java has on other language
Java guide
Java guide       Any beginner requires guidance to start with. A beginner in the field of java... practical guide to the beginner and experienced java programmer. These tutorials have
Servlet Tutorial for beginner
Servlet Tutorial for beginner  Hi, I am beginner in Servlet. I have learned the JSP a little bit. Now I wan't to learn Servlet. Tell me the URL... developed in Java. Servlet's run on Servlet container. Read more at Servlet
Hibernate programming tutorial for beginner
Hibernate programming tutorial for beginner  Hi, I am beginner in Hibernate and I wish to learn it quickly. I am hoping to learn the latest ORM... the link: Hibernate beginner tutorial. This link contains many tutorials
Java Tutorial
Java Tutorials If you are a beginner and looking for the Java tutorials to learn java programming language from scratch then this the best place to start with the Java programming language. Java programming language contains huge


Advertisement null