• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 226
  • Last Modified:

java programming

prompt the user to enter a fully qualified class name
If the class name they entered ends in ".class" strip that part off

I've tried my self to write code for the above requirement,am getting errors,could u pls help me?
0
sraveend
Asked:
sraveend
  • 8
  • 5
  • 4
  • +3
2 Solutions
 
zzynxSoftware engineerCommented:
>> I've tried my self to write code for the above requirement,am getting errors,could u pls help me?
Yes, we could. If you show us what code you have and what errors.
0
 
zzynxSoftware engineerCommented:
The functions
   - String.endsWith()
   - String.substring()
will be useful
0
 
zzynxSoftware engineerCommented:
Here at EE we're not allowed to write (homework?) code for you.
Only to help you with problems that occur in your own code.
So...
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
gdrnecCommented:
String fqcName = // user entered class name
int index = fqcName.indexOf(".class");
if (index !- -1) fqcName = fqcName.substring(0, index);

Is that what you need?
0
 
gdrnecCommented:
Oooops. Didn't think about the homework thing. If this is homework, shame on both of us.

My appologies.

Geoff
0
 
zzynxSoftware engineerCommented:
>> If this is homework, shame on both of us.
*Both* of us? You mean yourself and the author, I hope.

btw. even shorter:    

     String fqcName = // user entered class name
     String fqcWithoutClass = fqcName.replaceAll(".class", "");

;°)
0
 
gdrnecCommented:
Quite.

;)
0
 
sudhakar_koundinyaCommented:
>>  Oooops. Didn't think about the homework thing. If this is homework, shame on both of us.

YOU DID THE RIGHT THING. YOU ARE NOT GIVING THE ENTIRE CODE.
0
 
sudhakar_koundinyaCommented:
strange, zzynx have already given the idea to you.
0
 
sudhakar_koundinyaCommented:
you could have split the points to both guys

Regards
Sudhakar
0
 
sudhakar_koundinyaCommented:
and also you have accepted wrong comment .
0
 
sraveendAuthor Commented:
Iam extremely sorry for using homework question!

0
 
sraveendAuthor Commented:
Hereafter i'll ask quetions with codings,Thanks a lot!
0
 
zzynxSoftware engineerCommented:
Thanks for ignoring me once again!
0
 
gdrnecCommented:
Hey zzynx,

Did I get all these points in error. I wouldn't want to alienate. Is there any way to share?

Geoff
0
 
zzynxSoftware engineerCommented:
Hi Geoff,
thanks for your honesty.
I already asked Venabilli to reopen it *once again*.
0
 
gdrnecCommented:
Not being obtuse here but I don;t see a split points link.

Geoff
0
 
zzynxSoftware engineerCommented:
Geoff, Venabilli's comment is meant for sraveend  (made a name mistake)
0
 
VenabiliCommented:
Yes. Sorry Geoff :(((

sraveend,

Any troubles?

Venabili
0
 
zzynxSoftware engineerCommented:
:)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 8
  • 5
  • 4
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now