Showing posts with label Abstract. Show all posts
Showing posts with label Abstract. Show all posts

Wednesday, June 11, 2014

Published 6/11/2014 by with 1 comment

This method requires a body instead of a semicolon

The reason for the error "This method requires a body instead of a semicolon" is same as described in the post missing method body, or declare abstrac...
Read More
    email this       edit

Thursday, May 19, 2011

Published 5/19/2011 by with 5 comments

is not abstract and does not override abstract method

See the code below: import javax.swing.JFrame; import javax.swing.JButton; import java.awt.Container; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class MyFrame extends JFrame implements ActionListener{ private JButton exitButton = new JButton("Exit"); public MyFrame() { Container container = getContentPane(); container.setLayout(new...
Read More
    email this       edit

Monday, May 9, 2011

Published 5/09/2011 by with 1 comment

illegal combination of modifiers: abstract and static

An abstract method cannot be static because the abstract method must be overridden i.e, body of the abstract method must be defined before invocation. See the wrong code below: public abstract class Employee { public static abstract double earnings(); // error } Here the abstract method earnings() is declared as static. An abstract method must be non-static. So the correct code is: public abstract...
Read More
    email this       edit

Tuesday, November 4, 2008

Published 11/04/2008 by with 0 comment

missing method body, or declare abstract

If we put a ; (semicolon) after the method header (i.e., before starting the method body) when we are defining a concrete method (which method has body) then we will see “missing method body, or declare abstract”. Another reason is if we don’t write the keyword ‘abstract’ for an abstract method (a method without body), we’ll also see this message. To resolve the problem we must remove the ; (semicolon)...
Read More
    email this       edit