• 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

Converting a String to Calendar object

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I want in my program to convert a String to an object of the Calendar type. The setDateOfBirth method in the bean class expects a Calendar object. This is what I've done so far. When I try to compile the program, I'm getting the following error. Please help me out..

C:\projects>javac -d ./ *.java
AddCustomer.java:36: 'void' type not allowed here
custbean.setDateOfBirth(cal.setTime(dt));
^
1 error




Thanks,
Babu
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
C:\projects>javac -d ./ *.java
AddCustomer.java:36: 'void' type not allowed here
custbean.setDateOfBirth(cal.setTime(dt));
^
1 error

The method setTime(...) in class Calendar does not return any value (it is a void method). In the line with the error you are trying to use the non-existent return value.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic