Forum: Java Sep 17th, 2009 |
| Replies: 8 Views: 794 The class that contians 'public static void main' must have static declared for all methods contained.
so your code should look like this...
public class Pay
{public static void main(String[]... |
Forum: Java Sep 16th, 2009 |
| Replies: 3 Views: 374 I have used "\t" to tab over to a lined up position. That could be an option for you. |
Forum: Java Aug 21st, 2009 |
| Replies: 3 Views: 339 char first = myString.charAt(0);
char newFirst;
if ('first' >='a' && <= 'z'){ //if is a lowercase char
newFirst = first-32;//32 is the difference from lowercase to capital
}
else{//*maybe... |
Forum: Java Aug 20th, 2009 |
| Replies: 5 Views: 224 A second option would be to just have a item count variable which increments every time an object is added to an array. Then if the count is > 10 give appropriate responce. |
Forum: Java Jul 30th, 2009 |
| Replies: 8 Views: 499 This doesn't address the lack of a method or correct the syntax of the switch statement.
Also there are no classes from java.util.* to be imported. |
Forum: Java Jul 30th, 2009 |
| Replies: 8 Views: 499 This should work for you.
class t {
public static void main (String [] args){
//do stuff
char s = 'Y';
displayStuff(s);
}//end main
public static void displayStuff(char s){ |
Forum: Java Jul 13th, 2009 |
| Replies: 6 Views: 552 If you want to do a switch using a String then you have to use an enum
Here is a link for how enums work and how to use them.
http://www.xefer.com/2006/12/switchonstring |
Forum: Java Jul 9th, 2009 |
| Replies: 1 Views: 387 your java file should be named the same as your class (in this case AverageNumbers.java should contain class AverageNumbers)
Also your main method should always be "public static void.main(String... |
Forum: Java Jun 30th, 2009 |
| Replies: 13 Views: 993 At this point I am probably as confused as you. =(
Do you think it makes a difference if the applet is run on your pc or on a web server? The getCodeBase() method may give an error from the folder... |
Forum: Java Jun 30th, 2009 |
| Replies: 13 Views: 993 The error is being thrown at line 26 of readFileApplet.java by the method getCodeBase().
I don't know for sure why. I haven't used URL or getCodeBase() before. Sun's documentation states that it get... |
Forum: Java Jun 30th, 2009 |
| Replies: 13 Views: 993 You are probably getting this error because you are trying to do an action on an object that is 'null'. I would add an if statement saying
if (myObjects == null){
System.out.println("this was... |
Forum: Java Jun 26th, 2009 |
| Replies: 4 Views: 237 What would you like an example of? Just let me know and can explain anything you need to know (hopefuly). =)
When I compile/run the program the method returns 84 as the value of area. Are you... |
Forum: Java Jun 26th, 2009 |
| Replies: 4 Views: 237 I would try
import java.lang.Math;
public class CalcDrive {
public static void main(String[] arguments) {
CalcTest one = new CalcTest(); |
Forum: Java Jun 23rd, 2009 |
| Replies: 4 Views: 292 |
Forum: Java Jun 23rd, 2009 |
| Replies: 2 Views: 916 I have used this to write files...
DataOutputStream output=
new DataOutputStream ( new FileOutputStream(txtFile + ".txt"));
output.writeUTF(text); |