| | |
Help Java novice
![]() |
•
•
Join Date: Oct 2006
Posts: 2
Reputation:
Solved Threads: 0
Hi All,
I am a total java novice and i am having a real problem running the following code:
This is actually from a book i am working through and if it isn't working i was wondering if there was something wrong with the code or my pc.
The error message reads:
1 error found:
File: C:\Documents and Settings\Steven\Desktop\Methods.java [line: 16]
Error: cannot find symbol
symbol : method setDay(int)
location: class java.util.Date
Please help
Thanks
Sarah
x
I am a total java novice and i am having a real problem running the following code:
java Syntax (Toggle Plain Text)
import java.util.*; public class Methods { public static void main( String [] args) { Date independenceDay = new Date ( 7, 4, 1776 ); int independenceMonth = independenceDay.getMonth(); System.out.println("Independence day is in month " + independenceMonth); Date graduationDate = new Date (5, 15, 2008); System.out.println("The current day for graduation is " + graduationDate.getDay() ); graduationDate.setDay(12); System.out.println( "The revised day for graduation is " + graduationDate.getDay() ); } }
The error message reads:
1 error found:
File: C:\Documents and Settings\Steven\Desktop\Methods.java [line: 16]
Error: cannot find symbol
symbol : method setDay(int)
location: class java.util.Date
Please help
Thanks
Sarah
x
Last edited by cscgal; Oct 27th, 2006 at 12:51 pm. Reason: [code=java] [/code] tags added
First of all, many of the methods in the Date class is depreciated. They are still implemented, but the Calendar class fills the same niche better.
As for your actual problem, you'd be after the setDate(int) method.
Check you the Java API if you haven't already.
As for your actual problem, you'd be after the setDate(int) method.
Check you the Java API if you haven't already.
Please anyone, correct me if I am wrong. It is the best way for me to learn.
There is no setDay() method in the Date Class, this mean your book must be old and you will get more similar problems...
Follow the link which David give it to you, in packages find java.util, then bellow find Date and read trough
I use now Deitel&Deitel JAVA How to Program 6th edition
Follow the link which David give it to you, in packages find java.util, then bellow find Date and read trough
I use now Deitel&Deitel JAVA How to Program 6th edition
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
![]() |
Similar Threads
- C++ Vs Java (C++)
- Chat program (Java)
- Java novice PLEASE HELP!!! (Java)
- Java Help!!! (Java)
- Java Expert (Needed) (Java)
Other Threads in the Java Forum
- Previous Thread: Telnet into Server
- Next Thread: I think Loop problem
| Thread Tools | Search this Thread |
android api applet application apps array arrays automation awt bidirectional binary birt bluetooth businessintelligence busy_handler(null) card chat class classes client code collision columns component constructor crashcourse database designadrawingapplicationusingjavajslider draw eclipse error errors eventlistener exception expand fractal game givemetehcodez graphics gui guidancer html ide image inetaddress integer intellij j2me java javafx javamicroeditionuseofmotionsensor javaprojects jme jni jpanel jtree julia linux list loop machine map method methods mobile mobiledevelopmentcreatejar myaggfun netbeans newbie oracle physics plazmic print problem program programming project recursion scanner server set sharepoint smart sms smsspam sort sortedmaps sql string subclass support swing textfield threads tree trolltech unlimited utility webservices windows






