473,788 Members | 3,101 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

java problem, need help please

6 New Member
I'm getting this message:
"C:\Documen ts and Settings\Evalda s\Desktop\moksl as\JAVA 2kursas\L2\cube method.java:5: class L2cubemethod is public, should be declared in a file named L2cubemethod.ja va
public class L2cubemethod extends Applet implements ActionListener"

Can please someone explain whats wrong with this program?:

Expand|Select|Wrap|Line Numbers
  1. import java.applet.Applet;
  2. import java.awt.*;
  3. import java.awt.event.*;
  4.  
  5. public class L2cubemethod  extends Applet implements ActionListener
  6. {
  7.     Label lblnumber;
  8.     TextField tfnumber;
  9.  
  10.     int number;
  11.     int cube;
  12.  
  13.     public void init()
  14.     {
  15.         lblnumber = new Label( " Enter your number and press Enter:");
  16.         add(lblnumber);
  17.  
  18.         tfnumber = new TextField(10);
  19.         add(tfnumber);
  20.  
  21.         cube = 0;
  22.  
  23.         tfnumber.addActionListener(this);
  24.     }
  25.  
  26.  
  27.     public void actionPerfomed( ActionEvent e)
  28.     {
  29.         number = Integer.parseInt(e.getActionCommand() );
  30.  
  31.         cube = number*number*number;
  32.         tfnumber.setText("");
  33.         showStatus ( Integer.toString( cube) );
  34.     }
  35. }
Oct 13 '07 #1
6 1520
Ganon11
3,652 Recognized Expert Specialist
It seems you have saved the file an improper name. You should have saved your file as "L2cubemethod.j ava" typed exactly that way.
Oct 13 '07 #2
frozzenn
6 New Member
It seems you have saved the file an improper name. You should have saved your file as "L2cubemethod.j ava" typed exactly that way.
C:\Documents and Settings\Evalda s\Desktop\moksl as\JAVA 2kursas\L2\L2cu bemethod.java:5 : L2cubemethod is not abstract and does not override abstract method actionPerformed (java.awt.event .ActionEvent) in java.awt.event. ActionListener
public class L2cubemethod extends Applet implements ActionListener
^
1 error

Tool completed with exit code 1

I think file name I saved is the same:" L2cubemethod.ja va" still get this message. Im so tired of this. Any other suggestions?
Oct 15 '07 #3
Ganon11
3,652 Recognized Expert Specialist
OK, this is an entirely new error. In this one, just read the text: You say your class implements ActionListener. Well, one of the requirements for saying your class implements ActionListener is to provide a method called actionPerformed that accepts an ActionEvent parameter - which you must not have done.

EDIT: Then again, maybe you did.
Oct 16 '07 #4
r035198x
13,262 MVP
...

EDIT: Then again, maybe you did.
He did not. He got the spelling for actionPerformed wrong.
Oct 16 '07 #5
frozzenn
6 New Member
He did not. He got the spelling for actionPerformed wrong.

Thank you very much guys. Spend hours looking for error. And it was just spelling. Thank you.
Oct 16 '07 #6
JosAH
11,448 Recognized Expert MVP
Thank you very much guys. Spend hours looking for error. And it was just spelling. Thank you.
Keep it in mind: when your class is not abstract and the compiler is whining that
it should be abstract it also tells you the methods that need be implemented from
either an abstract parent class or an implemented interface. If you think you *did*
do so, you've made a typo in at least on of those methods.

The compiler can't pinpoint you to the line where you made a mistake because
you have all the rights to implement *other* methods with names you picked.

kind regards,

Jos
Oct 16 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

2
49361
by: Ann | last post by:
Hi, Is there any way to Change encoding of Java Vm to ISO-8859-1? i am using Java vm along with an application called opencms. I get the following error message.. Error: the encoding of your Java VM is different from the OpenCms encoding! Java VM file encoding: UTF-8
3
5193
by: StealthMonkey | last post by:
Let me prefix this by saying that I know next to nothing about Java (so please try to keep explainations simple). I use PHP for my server-side web programming. Here is my dilemma: I need a JavaScript function to be called with a dynamic parameter, an ID# known by the server. The way I would go about doing this in PHP would be extremely simple: <script> foo(<?PHP echo ID; ?>);
7
11085
by: Oleg Konovalov | last post by:
Hi, I am trying to pass a bunch of checked checkboxes (Javascript array) from page1 to the Java action class on subsequent web page (page2). (on page 1 I have a bunch of DB rows with a checkbox, need to iterate through pages page2 - e.g. allow user to update the fields there) On page1 I have a bunch of checkboxes with the same name v1 but different values (= DB rowId).
1
9654
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej and I was wondering if anyone here would be able to give me some tips for young players such as myself, for learning the language. Is this the best Newsgroup for support with JAVA?
458
21482
by: wellstone9912 | last post by:
Java programmers seem to always be whining about how confusing and overly complex C++ appears to them. I would like to introduce an explanation for this. Is it possible that Java programmers simply aren't smart enough to understand C++? This is not merely a whimsical hypothesis. Given my experience with Java programmers --- the code they write and the conversations they have --- Occam's Razor points to this explanation. For example,...
11
1593
by: vortex93 | last post by:
hello, i have IE 6 and all the things that need for java in Security Settings are Enable and i still have problems with java like: when i want to open a window that have javascript as link it's not works... or like, i want to download a file that i need to enter a code that need java it's not work too..
14
5693
by: mlw | last post by:
Do not take anything about this, it is not a flame or troll, while I'm not new to Java I favor C++. However, I may need to use it in a contract position, and am concerned that the restrictions it places on application code. Take, for instance, this C++ construct: class foo { char *m_name;
6
2291
crystal2005
by: crystal2005 | last post by:
Hello guys, I'm a beginner in Java application programming. I started to write a Java application in which link to MS Access database. I encountered a problem in deletion function. E.g. I would like to delete one record in database, it always shows "record not found" in my program, even if the data has been deleted. I tried to used function for each choices. But the compiler showed that we can't used function in static void. Is there...
1
5994
by: okonita | last post by:
Hello all, I have a Java problem that I hope can be answered here. Very new to DB2 UDB and UDF (we are on DB2v9.5, Linux and Windows), I have managed to get the UDF registered but having problem getting the Java code to work. I need assistance to get this Double Metaphone Java UDF to work pretty quickly. Here is what I tried to run and the error message that resulted: SQL select nm_frst, NM_LST,...
0
9655
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9498
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10172
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10110
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8993
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7517
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5398
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4069
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.