answersLogoWhite

0

A Java class is expected to have all functions defined. The purpose of defining the methods is to decide on its expected functionality and behavior.

Only in case of Interfaces we declare methods but leave the method definitions to the implementing classes.

User Avatar

Wiki User

16y ago

What else can I help you with?

Related Questions

What is the use of api in java?

The API is a reference for all predefined classes provided by the java language. This will allow the programmer to utilize the classes into their programs. The API provides packages, classes, methods, constants, etc.


What makes up a Java class?

Fields and methods. Fields are variables defined at the class level, i.e., they are available for all methods. Methods are the equivalent of functions / procedures, but they are defined for a specific class.


What are factory methods in java?

A factory class is any class which is used to create instances of other classes. The methods which create those classes are the factory methods. For example, the BorderFactory class has a variety of methods for creating instances of the different types of the Border classes. BorderFactory.createEmptyBorder(); BorderFactory.createEtchedBorder(); ...


Is the any class containing main function in a webapplicatin?

No. Java classes in web applications do not have Main Methods.


Why constructor rather than classes in java?

Constructor is not an alternative to class. In Java, you create classes; the classes contain methods - including the constructor, which can be viewed as a special method. If you want to have a constructor, you need a class that surrounds it, so it's not one or the other.


What are sealed classes in java?

Final classes are sealed classes in java I guess.


Is sizeof keyword in Java?

sizeof is not a keyword in Java but many classes have size() or length() methods, which can mean the number of elements, characters, etc. depending on the class.


How many classes should be included in each java file?

You can only have one non-inner public classes per java file and that class name must match the filename. The java file can also have any number of inner classes and anonymous classes.


Can userdefined exception have two methods in it?

Yes a user defined exception can have any number of methods in it. A user defined exception is nothing but a Java class created for a specific purpose. Just like ordinary Java classes, you can have any number of methods in it...


How many classes are there in java?

there is one method only. go to command prompt and type this to know the methods. D:\java>javap java.awt.event.ActionListener Compiled from "ActionListener.java" public interface java.awt.event.ActionListener extends java.util.EventListener{ public abstract void actionPerformed(java.awt.event.ActionEvent); }


What Java header file meaning?

Source code written in Java is simple. There is no preprocessor, no #define and related capabilities, no typedef, and absent those features, no longer any need for header files. Instead of header files, Java language source files provide the declarations of other classes and their methods.


How do you prevent inheritance in java?

If a class is declared as final, you can't inherit from it. If individual methods are declared final, then, if the class is inherited, these methods can't be changed in the inherited classes.