File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Help with this JAVA statement ASAP..PLEASSEEE Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Help with this JAVA statement ASAP..PLEASSEEE" Watch "Help with this JAVA statement ASAP..PLEASSEEE" New topic
Author

Help with this JAVA statement ASAP..PLEASSEEE

jayson clark
Greenhorn

Joined: Mar 14, 2005
Posts: 14
Identify the mistake in the statement below :

private static public final String sabc=123456;
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
Identify the mistake in the statement below :

private static public final String sabc=123456;

i'd go for ... several
private and at same time public
if string should be ...="123456";
finally if final should be in caps like SABC


java amateur
jayson clark
Greenhorn

Joined: Mar 14, 2005
Posts: 14
So is this right though:

public class String
(
private Final static String sabc="123456";

)


Thank you
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 31079
    
163

Cathy,
Note that Java is case sensitive so "Final" should be "final".

And welcome to JavaRanch!


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
jayson clark
Greenhorn

Joined: Mar 14, 2005
Posts: 14
OK so the Corest statement is:

public class String
(
private final static String sabc="123456";

)
Thanks much
jayson clark
Greenhorn

Joined: Mar 14, 2005
Posts: 14
can anybody look at my codes if its right? pleaseeee i need to submit this tonight...

public class String
(
private final static String sabc="123456";

)
[ March 14, 2005: Message edited by: cathy sio ]
David Harkness
Ranch Hand

Joined: Aug 07, 2003
Posts: 1646
I'd high recommend against creating your own class named "String". Other than that, the syntax is fine. Off hand, what happens when you compile it? If it is working, why keep asking us what's wrong with it? If it isn't working, post the error your getting.

If you haven't even tried to compile it, you can't be in that much of a hurry.
Nick George
Ranch Hand

Joined: Apr 04, 2004
Posts: 815
A:
Brackets, not parentheses:

private class FunnyString
{
...
}

B:
What the hell are you trying to do?!


I've heard it takes forever to grow a woman from the ground
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

As written, even with the braces, this won't work, because the "String" in the variable declaration will refer to the enclosing class, not to java.lang.String. You'll get an an error about "incompatible types". You need to change the name of the class.


[Jess in Action][AskingGoodQuestions]
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 31079
    
163

As Miguel pointed out "SABC" should be capital. While it isn't wrong, this is a good habit to get into.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help with this JAVA statement ASAP..PLEASSEEE