The imports in that class file are:
import javax.swing.*;
import java.util.*;
I am using JBuilder 2005 aswell, could that make any difference ?
Main Topics
Browse All TopicsHey,
I am trying to set the month of a calendar but having an issue with it that I hope you folks can resolve.
// booking class file
Calendar cal = new GregorianCalendar();
// get current date info
int currDay = cal.get(Calendar.DATE);
int currMonth = cal.get(Calendar.MONTH)+1;
int currYear = cal.get(Calendar.YEAR);
// line below causing error, asking for identifier
cal.set(Calendar.MONTH, 1);
int daysInMonth = cal.getActualMaximum(Calen
Tried all sorts of alternatives and examples from EE and google but with no success, I just appear to be going in circles. Can anybody help ?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
import java.util.*;
public class ebh {
booking myBooking = new booking();
public static void main(String args[]) {
ebh myEbh = new ebh();
int currDay = myEbh.myBooking.returnDay(
int currMonth = myEbh.myBooking.returnMont
int currYear = myEbh.myBooking.returnYear
int daysInMonth = myEbh.myBooking.returnDays
JOptionPane.showMessageDia
System.exit(0);
}
}
import javax.swing.*;
import java.util.*;
public class booking {
Calendar cal = new GregorianCalendar();
// get current date info
int currDay = cal.get(Calendar.DATE);
int currMonth = cal.get(Calendar.MONTH)+1;
int currYear = cal.get(Calendar.YEAR);
// error on line below <identifier> expected
cal.set(Calendar.MONTH, 1);
int daysInMonth = cal.getActualMaximum(Calen
public int returnDaysInMonth() {
return daysInMonth;
}
// booking start date info
// booking end date info
// temp duration
int duration = 5;
public int returnDay() {
return currDay;
}
public int returnMonth() {
return currMonth;
}
public int returnYear() {
return currYear;
}
}
Context is everything ;-) The code should be in a method:
class booking {
Calendar cal = new GregorianCalendar();
private int currDay;
private int currMonth;
private int currYear;
private int daysInMonth;
public booking() {
currDay = cal.get(Calendar.DATE);
currMonth = cal.get(Calendar.MONTH)+1;
currYear = cal.get(Calendar.YEAR);
cal.set(Calendar.MONTH, 1);
daysInMonth = cal.getActualMaximum(Calen
}
public int returnDaysInMonth() {
return daysInMonth;
}
// booking start date info
// booking end date info
// temp duration
int duration = 5;
public int returnDay() {
return currDay;
}
public int returnMonth() {
return currMonth;
}
public int returnYear() {
return currYear;
}
}
Business Accounts
Answer for Membership
by: CEHJPosted on 2007-07-19 at 11:23:10ID: 19524657
There's nothing wrong with the code you posted if you have the correct imports. Any error is elsewhere