| | |
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 |
911 actionlistener addball addressbook android applet application apps array automation binary bluetooth businessintelligence button card character class client code collision component consumer crashcourse css csv database desktop eclipse ee error fractal free ftp game givemetehcodez graphics gui html image integration j2me japplet java javaarraylist javac javadoc javaee javafx javaprojects jni jpanel julia jvm linked linux loan mac method migrate mobile netbeans objects online oriented phone physics printf problem program programming project projects radio recursion replaydirector reporting researchinmotion rotatetext rsa scanner se server service set sms software sort sql swing test textfield textfields threads time tree trolltech ubuntu update utility windows






