Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

"<identifier> expected" error

807599Dec 18 2006 — edited Dec 18 2006
Hi, can anyone please help me to print "String bb" outside the method. I am getting "<identifier> expected" error. My code is


public class Main extends javax.swing.JFrame
{
/** Creates new form Main */
static String bb="";
public Main() {
initComponents();
}


[... lines of code ...]


private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt)
{
String b=null;
String bb=null;
Object a=jComboBox1.getSelectedItem();
b=(String)a;
bb=b.substring(0,1);
System.out.println("bb"+bb);//able to print here
}
System.out.println("bb"+bb);//I need to print "bb" here, but the error thrown is "<identifier> expected"
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 15 2007
Added on Dec 18 2006
16 comments
391 views