Link to home
Start Free TrialLog in
Avatar of ajdratch
ajdratch

asked on

help learing JAVA

I am attempting to learn Java for a hobby (haven't written code in 15 years) I am using netbeans and found a good document on oracle.com to help get started however either I am missing the obvious or there is a problem with this site. I'm hoping someone can tell me how to get this to work.

The article is http://www.oracle.com/technetwork/java/netbeans-part1-142734.html#figure7. If you scroll down a bit it tells you to name the variable jlabel6, jlable7 and jlabel8 to  ******

When I try that it says it is not a valid variable name. I would think that it needs to be variable name, not asterisks since it will be the results of a calculated field.

Any help for a beginner is very much appreciated.
Avatar of for_yan
for_yan
Flag of United States of America image

They recommedn to change not the variable name but the contenst of the text of the label
Avatar of Gurvinder Pal Singh
i guess that is the label of the field rather than the  name
Variable name in java can only start with letter and contain charcacters , distis and underscore
They are talking about the contesnt of the text of the lable this contents is data - struig and it can be blank, or asteriksk, or amny
printesd symnbols,
the name of the variables does not need to be changed at this point
I think they misplace this remark, yuou cannot change jlablel to ****

To rename a component, right-click it in either the Design Editor or the Inspector and choose Change Variable Name. Change names for the following components:


This part

Variable  Text  
jLabel6  **********
jLabel7  **********
jLabel8  **********
jTextField1  [blank]
jTextField2  [blank]

is obviously jsut continuation of this part

Variable  Text  
jLabel1  Hours Worked:
jLabel2  Rate/ Hour ($):
jLabel3  Regular Pay:
jLabel4  Overtime Pay:
jLabel5  Total:
jButton1  Compute

On the left side is the conteents of the text of the lable or JTextFiled (blanks for JTextfIleds of course)


you first learn what is oops and kearn c# first this might helps in feature also..
ASKER CERTIFIED SOLUTION
Avatar of for_yan
for_yan
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ajdratch
ajdratch

ASKER

It looks like they left out some information. I needed to name those variables according to the last lines of code

regularPayField.setText(" " + nfRegular.format(regularPay));
overtimePayField.setText(" " + nfOverTime.format(overTimePay));
totalField.setText(" " + nfTotal.format(total));