This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have David & Dawn Griffiths on-line!
See this thread for details.
Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

calling char value

 
Ranch Hand
Posts: 30
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator



Hello everyone, i have doubt in 'char' datatype. how can we call the char method into main method. for example here in this program we are calling all types of datatype such as int, double, short, and doing addition,subtraction, multiplication and division. i want to call even the char by giving any name as value how is it possible.

 
Saloon Keeper
Posts: 8750
71
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When posting code please high light your code and use the "Code" button above the edit box. I fixed it for you this time.
 
Carey Brown
Saloon Keeper
Posts: 8750
71
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
On line 19 in the name() method you declare a char variable with the name 'z'. This variable is local to and only visible inside name(). Your main() method does not have a 'z' variable so you are getting this error.

In addition your name() method is expecting two char values and in main() you are only calling it with one. You'd need something like:
Also note that "James" is a String, not a char, so you can't do
 
nicky priya
Ranch Hand
Posts: 30
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
color=black] [/color]

i am sorry i'll do it from next time Thank you.[
 
nicky priya
Ranch Hand
Posts: 30
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Can I get out put as  name such as 'James Gosling'  instead of a b.
 
nicky priya
Ranch Hand
Posts: 30
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Okay i got it. Thank you very much.
 
Carey Brown
Saloon Keeper
Posts: 8750
71
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
 
nicky priya
Ranch Hand
Posts: 30
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
 
reply
    Bookmark Topic Watch Topic
  • New Topic