craig prothero

Greenhorn
+ Follow
since Aug 14, 2000
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by craig prothero

Has there been any progress in developing more assignments? I just finished the cattle drive and want to continue to learn.
Thanks
Craig
Also I would be willing to volunteer if you need more help with this web page.
23 years ago
I tried that (see code below) and I get an error that says "Illegal start of expression" and points to the 90th position on each line of the String array declaration. Do I need to identify the arrays differently?
Thanks
public String format3Digit( int number )
{
int onesDigit = number % 10 ;

[This message has been edited by Paul Wheaton (edited August 22, 2000).]
23 years ago
How do you assign the static initiator to variables.
23 years ago
I am confused. What is the Character Class as defined on the Sun website.
It looks like there is a character method toString()
This looks exactly like the string method length.
Therefore if
int sampleLength = args[0].length()
works, then

char c = args[0].charAt(0) ;
String sample = c.toString() :
should also work considering that the syntax for each method is exactly the same.
If Char is a primitive type, what is the Class Character and what is the difference.
Thanks
23 years ago
How about if I wanted to convert to String:
I tried
char c = args[0].charAt(0)
String c.toString()
and I got the same message.
Thanks
23 years ago
I am trying to experiment with character Methods and get a the error message that "char cannot be dereferenced".
Here is the code:
String s1 = args[0] ;
char c = s1.charAt( 0 ) ;
char c2 = c.charValue() ;
The error is in the last statement. What am I missing?
Thanks
23 years ago
Yes that helped a lot.
Thanks
23 years ago
I have a frustating problem and I know I am doing something wrong.
I am trying to retrieve the Character length of a String and it does not seem to work.
I have tried the following code and it returns the number of words in the string:
class New {
public static void main (String args[]){
int x = args.length;
System.out.println ( x ) ;
}
}

I tried the following code and get an error while compiling.
class New {
public static void main (String args[]){
int x = args[0].length;
System.out.println ( x ) ;
}
}
What am I doing wrong?
Thanks
Craig
23 years ago
Steve,
As I looked at this I do not see how you are changing the value of x.
x is initialized in the for statement, but for every loop, the value of x does not reset.
Does this help or am I off base.

23 years ago
I am trying to recognize a new class that is needed for this assignment. Here is the code (I x'd out the actual class to not give that away) It is coming back with 2 errors when compiling:
1-Integer number to large
2-Operator * cannot be used on java.math.XXXXXX,java.math.XXXXX.
Here is the code
import java.math.XXXXXX;

class New {
public static void main (String args[]){
XXXXXX y = 271474976710656;
XXXXXX x = y*y;
System.out.println("This is a Big Integer: " + x);
}
}
Can someone help me with this? Am I importing incorrectly?
Thanks you for your help.
Craig
23 years ago