Home Answers Viewqa Java-Beginners how can i define only one method from the interface.

 
 


Rajeevgandhi
how can i define only one method from the interface.
1 Answer(s)      4 years and 5 months ago
Posted in : Java Beginners

View Answers

January 10, 2009 at 12:35 AM


Hi friend,

If u declare the methods in interface then it must be define in the class
that implement the interface.

for e.g :

interface abc
{
public void m1();
public void m2();
public void m3();
}
class c1 implements abc
{
public void m1()
{
System.out.println("Hello world");
}
public void m2()
{
System.out.println("Hello world");
}

public void m3()
{
System.out.println("Hello world");
}

}


Thanks









Related Pages:
how can i define only one method from the interface. - Java Beginners
how can i define only one method from the interface.  If i am having an interface with 3 methods(declaration) . If i want to use only one method..., If u declare the methods in interface then it must be define in the class
interface
interface   Hi I have interface in that interface 3 methods are there , after some days client said that,i want to add one more method in that interface ,so how can add 4 method so that the implemented class did not affect
Example of static method
cannot be referenced from a static context. Static method can call only other static... constructing a object of the class. You will find that only static method can... of the instance methods and static methods then you can know where to use instance method
interface
? In such a case how can we say that java doesn't supports multiple inheritance   Through interface, we can achieve the multiple inheritance. Java does...interface  What is the exact use of interface in real time scenario
Java Interface
extends the other interface. 3. How a class can implement one or more than one.... An interface can't implement another interfaces rather it can only extend... define the body of method, we can't use the curly braces with the declared
The interface keyword
to declare and define an interface. Keywords are basically reserved words which... to implement an interface by a class. Interfaces in java are abstract means they can... to declare and define an interface. [visibility] 
Interface in java with example
static constant and abstract method. We can only implement a class and extended it by other interface. We can extend one or more other interfaces but cannot... method heading listed in interface. We can take the interface check
Works only for one row
Works only for one row   Hi, My below code is working only... retrieved from the database. <%@page import="java.util.concurrent.CountDownLatch...{ ps=con.prepareStatement("Select DBID,Query_Raised,TR from Scope1 where TR
how can i display the dates of one week by selecting the date randomly from the calendar?
how can i display the dates of one week by selecting the date randomly from... display the calendar, simultaneously i want to display the list of seven dates from the date selected from the calendar. how can we display the dates by picking
Interface
Interface  I need to implement the interface without overriding its method and also don't use abstract class for this. How to do
Interface - Java Interview Questions
interface names anywhere you can use any other data type name. If you define...: These are same as abstract classes only difference is we an only define method... they can not be directly instantiated. To define the methods of an interface
Interface
Interface  Can Any one Give the exact program explanation... inheritance? Thanks in advance   An interface is one which has abstract... method it will take.It creates complexity.Therefore java uses Interface
can interface solve this problem in java
can interface solve this problem in java  I have a JDialog which displays the calendar [from 2010-2020], i created this in a different class... this calander class. can interface solve this problem. If yes then how. pls
how can create pop() method in this program ,Or how can delete image in it when i press pop button in runtime ??? please help me ...
how can create pop() method in this program ,Or how can delete image in it when... safety, * this method should be invoked from the * event-dispatching thread... dose the work method ? } if(e.getSource() == b1) { pop();// i wont if i press
I want only one method goes to sleep but both method goes to sleep together
I want only one method goes to sleep but both method goes to sleep... and Computer's turn. But when i call Sleep() before cpuPlay() method or after... really tried very hard to find why it is making sleep() to both method together but i
I want only one method goes to sleep but both method goes to sleep together
I want only one method goes to sleep but both method goes to sleep... and Computer's turn. But when i call Sleep() before cpuPlay() method or after... really tried very hard to find why it is making sleep() to both method together but i
how to pass a string from one class to another
. there is only one return used in one class. But i want two kinds of input. How...how to pass a string from one class to another  hi all, Good morning. I am trying to develop a coding pass a string from one class and declare
DOM importnode, Example of importnode method of document interface.
XmlDocument.ImportNode() Example In this example, we are going to know how we can make a program to import a node from another document to the current document. The importNode () method creates the duplicate of the node
Given a list of methods for a stateful or stateless session bean class, define which of the following operations can be performed from each of those methods: SessionContext interface metho
, define which of the following operations can be performed from each... Business method from component interface SessionContext... Business method from component interface SessionContext methods
Java-Generic Interface
). Could some one guide me what are the possible way I can go about it,How can I... it to string.also is there any possibility that I can use simple java program... and publish it to java program -Now we are getting request from other modules in our
How can i Dispose Dialog box From LWUIT Component >
How can i Dispose Dialog box From LWUIT Component >  Hi All, i am Developing one mobile application using lwuit,Midlet.in that am trying to show a dialog when i press key "0". again if i press key "4" the Dialog should
MySQL User Interface
; In this section you will read how to define the function Interface...;: You can add function with the help of UDF (user defined function) interface... add and delete rows from the mysql.func table. User-defined function can be have
how can i use one dbase conection in serveral pages - JSP-Servlet
how can i use one dbase conection in serveral pages  Hi! Thanks... connections many times whereever i need in several pages. How can I avoid this....that means i want to write only one time and i want to call that in other pages
how can i calculate loan - Java Interview Questions
how can i calculate loan  negotiating a consumer loan is not always... as the total interests owed. that amount is immediately deducted from the face value, leaving the consumer with only 775. repayment is made in equal monthly installment
Console vs Dialog I/O
, introductory examples are often limited to using only dialog boxes for I/O. Console I/O is less useful. Console I/O was the only kind of I/O.... It can be used for input from the console and files, but not for GUI input
How i write a function/method in jsp?
How i write a function/method in jsp?  How write the function/method in jsp? Using that method i can retrieve the value coming from database. give.... And the details come from different table and id is store in user table. I hope you all
How to check if a file is read-only in java
How to check if a file is read-only in java A read-only file is any file with the read-only attribute. Read-only files can be opened and accessed but you will not be able to make changes to it. You can make a file read-only by using
Introduction to List and Queue Interface
: The List interface extends the Collection interface to define... extends the Collection interface to define an ordered collection for holding... of this interface are as follows. Method Uses
How can I Define a JFrame subclass that has four vertically positioned buttons. - Java Beginners
How can I Define a JFrame subclass that has four vertically positioned buttons.  How can I Define a JFrame subclass that has four vertically...*; public class DisplayButtons extends JFrame { int i=0; static JPanel panel
interface - Java Beginners
: An interface is a named collection of method definitions (without implementations). An interface can also include constant declarations. * A class inherits only constants from an interface. * A class cannot inherit method
How can i search and insert within a query
How can i search and insert within a query  if it is possible... that when seat numbers more then one problem generates how insert multiple values... semester and degree if i search batch 2008 , semester first and degree bscs then search
how can i hide and show tables
how can i hide and show tables  hai, i am creating a form which the code is included below i want to hide the tables initially and after i click go i want to display the tables with result.so any help is appreciated much <
I have only one day to visit the Jaipur..
I have only one day to visit the Jaipur..  Hi, I have only a day to travel in Jaipur ..hence, bit worried about what to see first
objective c define float
objective c define float  Hi, How to define float variable.... float i; i=10; Thanks   Hi, Here is another example: // File : myClass.h @interface myClass { float value; } @property float value; @end
How can I do it? .click();
How can I do it? .click();  I have a very unusual problem. I want...("a"); x.click(); </script> So it's click on an element witch one Id's is "a", but I want that it make mouseup in this element. How can I do it, because if I write
Markable Interface
Markable Interface  In Java can we create our own Markable Interface?? If yes then how, Please explain with example   Marker interface... the concept of marker interface you should go through one more example. Suppose
Hibernate criteria - how to use criteria to return only one element of an object instead the entire object.
Hibernate criteria - how to use criteria to return only one element of an object instead the entire object.  How to use criteria to return only one... projection to select one element of object. Here is an example to retrieve only name
Set Interface
. It permits a single element to be null. The Set interface contains only methods inherited from Collection interface, these are shown in the table given below... of the Set interface. This implementation differs from HashSet that it maintains
method
method   how and where, we can define methods ? can u explain me with full programme and using comments
JdbcRowSet interface
JdbcRowSet interface In this section we will read about the JdbcRowSet interface in Java. javax.sql.rowset.JdbcRowSet is an interface which is a wrapper... the ResultSet objects scrollable and updatable. Object of interface
Marker Interface,Java Marker Interface
are abstract in nature so they can not be directly instantiated. To define the methods... abstract method. Interface combines the two functionality (template and multiple inheritance) of C++ language into one (in itself).  Interface Definition
Kilometers to Miles - User Interface Only
Java NotesExample - Kilometers to Miles - User Interface Only This program produces a user interface, but there is no listener for the button so..., output field // This is the user interface for the Km to Mi conversion
How to navigate from one jsf to another in eclipse
How to navigate from one jsf to another in eclipse  Hi there is my... page only even after submitting the form... I have checked it many time...:form> </f:view> </body> </html> Hello guys i have been
define a constant.
define a constant.  How do you define a constant?   Hi, With the help of define() directive, you can create constant in php. And here is how: <?php define('NAME', 'Bharat'); ?> Thanks
interface
interface  what the use of interface?   An interface is one... variables.Any class can implement(inherit)the interface and make use... is achieved by using the interface (by implementing more than one interface at a time
How can I get the full URL with the attached parameters? - JSP-Servlet
How can I get the full URL with the attached parameters?  Hi, I'm trying to figure out how to get the current url and use it in my jsp page. I...:8080/MesEduSchoolsProject/displayMenu.jsp How can I get the full URL with the attached parameters
Facelet define Tag
;  This tag contains only one attribute : name : This attribute is used to give...Facelet define Tag          This tag is used to define the name of the content
How can i Change Button Label Value Randomly in VIRTUAL KEYBOARD using JAVA or Net Beans ???
not possible in Java otherwise in VB or NetBeans solu Sothat i can use only Method...How can i Change Button Label Value Randomly in VIRTUAL KEYBOARD using JAVA or Net Beans ???  How can change Button Label value Every Time when
How can i Change Button Label Value Randomly in VIRTUAL KEYBOARD using JAVA or Net Beans ???
not possible in Java otherwise in VB or NetBeans solu Sothat i can use only Method...How can i Change Button Label Value Randomly in VIRTUAL KEYBOARD using JAVA or Net Beans ???  How can change Button Label value Every Time when
How can i pass the valus from a JSP to the action class???
How can i pass the valus from a JSP to the action class???  hewllo wevryone... can anyone help me with how i can pass the value of menuId in my JSP and pass it in the action class

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.