• 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

please help me ...

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys i using jdk1.6 i m writing this program but this gives me a lot of error.. donno why....

here is the program. Its very simple... i sets the time and shows the new time

-----------------------------------------

import java.util.*;

class Date
{
public static void main(String[] args)
{
Date d1 = new Date(10000000000000L);
System.out.println("The date is " + d1.toString());
d1.setTime(d1.getTime() + 3600000);
System.out.println("New Date is " + d1.toString());
}
}

---------------------------------------
i dont know y i m gettin this ..
my system time has also been set correct.....
please help me....
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You should change the class name from "Date" to something else. Date class is already defined in java API.
 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Or else replace first line of main method with following-

<blockquote>code:
<pre name="code" class="core"> java.util.Date d1 = new java.util.Date(10000000000000L); </pre>
</blockquote>

[ July 17, 2008: Message edited by: Sumit Gaikaiwari ]
 
shashi booshan
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks
 
shashi booshan
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Again in this program im gettin the same problem...
this time i tried my best... bt dint worked out...
so many error coming saying incompatible types, cannot find symbol etc...
please help
<blockquote>code:
<pre name="code" class="core"> import java.util.*;

class Dates1
{
public static void main(String[] args) {
Date d1 = new Date(10000000000000L);
System.out.println("1st Date is:" + d1.toString());

Calendar c = Calendar.getInstance();
c.setTime(d1);

if(c.SUNDAY == c.getFirstDayOfWeek())
System.out.println("First day of the week is Sunday");
System.out.println("Trillionth milli day of the week is " + c.get(c.DAY_OF_WEEK));

c.add(Calendar.MONTH,1);

Date d2 = c.getTime();
System.out.println("new Date is " + d2.toString());
}
}
</pre>
</blockquote>
 
Ranch Hand
Posts: 141
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This code is ok.
 
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
if its runtime error ... try to delete the .class file & compile the .java file again. If its compile time error, post what is the error

for me its running perfectly fine. gives following output

1st Date is:Sat Nov 20 11:46:40 CST 2286
First day of the week is Sunday
Trillionth milli day of the week is 7
new Date is Mon Dec 20 11:46:40 CST 2286
 
shashi booshan
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks guys.It worked
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic