By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,805 Members | 1,392 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,805 IT Pros & Developers. It's quick & easy.

Error in code: <identifier>expected

P: 1
Expand|Select|Wrap|Line Numbers
  1. public class HelloWorldBean implements HelloWorld 
  2. {
  3.     public void sayHello(String name); 
  4.             System.out.println("Hello, World");
  5. }
This is the code i want to execute but it is showing an error like <identifier>expected..
Dec 20 '12 #1
Share this Question
Share on Google+
2 Replies


Rabbit
Expert Mod 10K+
P: 12,422
You need to specify where the function begins and ends with curly brackets.
Expand|Select|Wrap|Line Numbers
  1. public class HelloWorldBean implements HelloWorld  
  2.     public void sayHello(String name)
  3.    { 
  4.             System.out.println("Hello, World");
  5.     }
Dec 20 '12 #2

P: 31
Hi! you have to start and close the curly brackets from where your function starts and you put a semicolon after function which is not allowed.
Expand|Select|Wrap|Line Numbers
  1.     public class HelloWorldBean implements HelloWorld  
  2.     { 
  3.         public void sayHello(String name)
  4.        { 
  5.                 System.out.println("Hello, World");
  6.         }
  7.     }
Dec 21 '12 #3

Post your reply

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