Subscribe Us

Core Java - Interview Questions and Answers

201. Which are keywords in Java?

a) NULL
b) sizeof
c) friend
d) extends
e) synchronized
Ans : d and e

202. When must the main class and the file name coincide?

Ans :When class is declared public.

203. What are different modifiers?

Ans : public, private, protected, default, static, trancient, volatile, final, abstract.

204. What is an example of polymorphism?

Inner class
Anonymous classes
Method overloading
Method overriding
Ans : c


Packages and interface

205. What are packages ? what is use of packages ?

Ans :The package statement defines a name space in which classes are stored.If you omit the package, the classes are put into the default package.
Signature... package pkg;
Use: * It specifies to which package the classes defined in a file belongs to. * Package is both naming and a visibility control mechanism.

206. What is difference between importing "java.applet.Applet" and "java.applet.*;" ?

Ans :"java.applet.Applet" will import only the class Applet from the package java.applet
Where as "java.applet.*" will import all the classes from java.applet package.

207. What do you understand by package access specifier?

Ans : public: Anything declared as public can be accessed from anywhere

private: Anything declared in the private can’t be seen outside of its class.
default: It is visible to subclasses as well as to other classes in the same package.

208. What is interface? What is use of interface?

Ans : It is similar to class which may contain method’s signature only but not bodies.
Methods declared in interface are abstract methods. We can implement many interfaces on a class which support the multiple inheritance.

209. Is it is necessary to implement all methods in an interface?

Ans : Yes. All the methods have to be implemented.

210. Which is the default access modifier for an interface method?

Ans : public.

Post a Comment

3 Comments

  1. 8 Web Design Tips to Increase Sales
    Every business owner wants a website that encourages users to take the next step: buying or communicating. This step is called conversion and is when the user converts to become a customer. If your website has a lot of traffic but few conversions, you need to determine why.

    How to change date of birth in facebook - Social Network
    On the social network Facebook, we do not laugh at birthdays. Best way to change date of birth in Facebook
    A priori you can only modify it yourself once by editing your user profile. There is no question of changing the date of birth every four mornings.

    Here is 150+ High Press Release link building sites 2021
    First of all, let's talk about why it is beneficial to use backlinks to improve your SEO process. Backlinks provide you with several things. By using backlinks, you can get better results and improve your search engine rankings. Keep in mind that you need a goal, which is to build backlinks leading to your home page plus individual pages. Google will also place more emphasis on websites with quality backlinks.

    ReplyDelete
  2. Buy Ambien Tablet Online
    Buy Ambien Tablet Online. We supply High quality Ambien, we are one of the best reputable vendors Best Chemical Shop. Zolpidem, sold under the brand name Ambien, among others

    Buy Baclof OD 30 Mg Online (100 Pills)
    Baclofen is a muscle relaxer and an antispasmodic agent.Buy
    Baclof OD 30 Mg Online
    Baclofen is used to treat muscle symptoms; such as spasm, pai
    and stiffness; caused by multiple sclerosis, spinal cord injuries,
    or other spinal cord disorders. It is given intrathecally (directly
    into the spinal cord) or orally (by mouth).Buy Baclof OD 30 Mg
    Online
    Quantity 100 Pills v| Clear

    ReplyDelete