• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

Help with this JAVA statement ASAP..PLEASSEEE

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Identify the mistake in the statement below :

private static public final String sabc=123456;
 
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
jayson clark
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So is this right though:

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

)


Thank you
 
author & internet detective
Posts: 41405
854
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Cathy,
Note that Java is case sensitive so "Final" should be "final".

And welcome to JavaRanch!
 
jayson clark
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK so the Corest statement is:

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

)
Thanks much
 
jayson clark
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 1646
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 815
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A:
Brackets, not parentheses:

private class FunnyString
{
...
}

B:
What the hell are you trying to do?!
 
author and iconoclast
Posts: 24204
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Jeanne Boyarsky
author & internet detective
Posts: 41405
854
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As Miguel pointed out "SABC" should be capital. While it isn't wrong, this is a good habit to get into.
 
If you were a tree, what sort of tree would you be? This tiny ad is a poop beast.
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic