• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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: 10741
86
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows ChatGPT
  • 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: 10741
86
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows ChatGPT
  • 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: 10741
86
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows ChatGPT
 
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