Thread: Java program question
-
July 1st, 2011, 05:50 PM #1Junior Member
- Join Date
- Jul 2011
- Posts
- 1
Java program question
Could somebody help me make this program compile...
import java.lang.Object;
public class Month
{
// instance variables
private int start;
private int end;
private String name;
private String months = "January " +
"February " +
"March " +
"April " +
"May " +
"June " +
"July " +
"August " +
"September" +
"October " +
"November " +
"December ";
/**
* Constructor for objects of class Month
*/
public Month(int x, int y)
{
//instance variables
start = x;
end = y;
}
public String getName()
{
name = months.substring(int start,int end);
return name;
}
}
This program is suppose to give the name of the month by putting in the right start number and end number in the substring method.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
Java program HELP! with GUI
By cory0789 in forum Webmastering and ProgrammingReplies: 3Last Post: April 24th, 2009, 01:42 AM -
running a java program
By sunny22 in forum Webmastering and ProgrammingReplies: 1Last Post: December 4th, 2005, 08:09 PM -
JAVA Program
By Stealth_Sniper in forum General Tech DiscussionReplies: 0Last Post: September 4th, 2004, 11:37 AM -
Java Program
By brandon184 in forum General Tech DiscussionReplies: 0Last Post: June 21st, 2004, 08:33 PM -
How to run Java Program
By jgargac in forum Webmastering and ProgrammingReplies: 3Last Post: February 4th, 2002, 08:58 PM



LinkBack URL
About LinkBacks



Reply With Quote

Invest in CPU and Graphics to deliver high performance.... no sh*t? You don't say? for a gaming PC? Who'd a thought?
Some help building a PC?