| | |
Help with java calendar
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved
![]() |
•
•
Join Date: Nov 2008
Posts: 16
Reputation:
Solved Threads: 0
I have a basic problem i dont know where the error lies.
i can create a class Persoon and fill in all its values before its created .
but for some reason when i call up the information i get the current Date as the birthdate and not what i have entered.
when i enter the birtdate directly into the class via its method after it has been created it will rmember it.
the all the geboorte things are related to the birthDate tho you can probably see by the use of calendar
can anyone see why or tell me while?
maybe i dont understand the calendar api .
but we were forced to use calendar or date
i can create a class Persoon and fill in all its values before its created .
but for some reason when i call up the information i get the current Date as the birthdate and not what i have entered.
when i enter the birtdate directly into the class via its method after it has been created it will rmember it.
the all the geboorte things are related to the birthDate tho you can probably see by the use of calendar
can anyone see why or tell me while?
maybe i dont understand the calendar api .
but we were forced to use calendar or date
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
/** * de persoon maken, hier word alles gemaakt wat * docent en student gemeen hebben. */ import java.util.*; public class Persoon { /** *variabelen instantieren */ private String naam;//voor methode setNaam private String geslacht;//voor methode setGeslacht private int leeftijd; private int geboorteDag; private int geboorteMaand; private int geboorteJaar; private Calendar geboorteInformatie = new GregorianCalendar(); /** * Constructor voor objecten van de class persoon */ //eigenschappen van persoon construeren public Persoon(String naam, String geslacht, int geboorteDag, int geboorteMaand, int geboorteJaar ) { this.naam = naam; this.geslacht = geslacht; this.geboorteDag = geboorteDag; this.geboorteMaand = geboorteMaand; this.geboorteJaar = geboorteJaar; } /** * methoden voor persoon */ //methode maken voor namen public String setNaam(String voornaam, String achternaam) { naam = voornaam + " " + achternaam; return naam; } //methode maken voor het geslacht public String setGeslacht(String manOfVrouw) { geslacht = manOfVrouw; return geslacht; } //methode maken voor geboortedatum public void setGeboorteDatum(int geboorteDag, int geboorteMaand, int geboorteJaar) { geboorteInformatie.set(geboorteJaar,geboorteMaand,geboorteDag); } private int getGeboorteDag() { geboorteDag = geboorteInformatie.get(Calendar.DAY_OF_MONTH); return geboorteDag; } private int getGeboorteMaand() { geboorteMaand = geboorteInformatie.get(Calendar.MONTH); return geboorteMaand; } private int getGeboorteJaar() { geboorteJaar = geboorteInformatie.get(Calendar.YEAR); return geboorteJaar; } public void print() { System.out.println("Jaar: " + geboorteInformatie.get(Calendar.YEAR) +" Dag: "+ geboorteInformatie.get(Calendar.DAY_OF_MONTH)+" Maand: "+ geboorteInformatie.get(Calendar.MONTH)); System.out.println("geslacht: " + geslacht); System.out.println("Naam: " + naam); } //checken welke persoon ouder is public boolean ouderDan(Persoon deAnder) { return geboorteInformatie.before(deAnder.geboorteInformatie); //als de geboorte van de eerste persoon eerder was dan de ander dan zal er true uitkomen } }
Last edited by Sereal_Killer; Dec 13th, 2008 at 5:33 pm. Reason: added code cause i forgot
![]() |
Similar Threads
- Making A Java Compiler... In Java (Java)
- Creating first GUI Java Program (Java)
- java calendar SWING (Java)
- Help Java novice (Java)
- Java holiday system not working... (Java)
- How to get the current date in JAVA (JSP)
- Trying to open explorer inside my java window (Java)
- Help with a Calendar!! (Java)
- help with sort using Calendar class getting null pointer exception (Java)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: popups without html
- Next Thread: Vertical Scrolling Gallery?
| Thread Tools | Search this Thread |
acid2 ajax ajaxcode ajaxexample ajaxhelp ajaxjspservlets animate automatically beta box browser bug captchaformproblem checkbox close codes createrange() css cursor debugger decimal dependent disablefirebug dom download dropdown editor element engine enter error events explorer ext file firefox form forms frameworks getselection google gwt gxt hiddenvalue highlightedword hint html htmlform ie7 ie8 iframe index internet java javascript javascripthelp2020 jawascriptruntimeerror jquery jsf jsp jump listbox maps masterpage math media menu microsoft mp4 object onmouseoutdivproblem onreadystatechange paypal pdf php player position problem programming progressbar prototype redirect regex runtime safari scale scriptlets search security select software sql text textarea unicode w3c window windowofwords windowsxp \n





