• 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
  • Ron McLeod
  • Tim Cooke
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Jeanne Boyarsky
Saloon Keepers:
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Piet Souris
Bartenders:

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: 9953
81
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: 9953
81
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: 9953
81
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
 
 
My cellmate was this tiny ad:
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
reply
    Bookmark Topic Watch Topic
  • New Topic