Solved

java programming

Posted on 2004-09-30
24
215 Views
Last Modified: 2010-03-31
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
Comment
Question by:sraveend
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 5
  • 4
  • +3
24 Comments
 
LVL 37

Expert Comment

by:zzynx
ID: 12193667
>> 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
 
LVL 37

Accepted Solution

by:
zzynx earned 250 total points
ID: 12193681
The functions
   - String.endsWith()
   - String.substring()
will be useful
0
 
LVL 37

Expert Comment

by:zzynx
ID: 12193741
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
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!

 
LVL 4

Assisted Solution

by:gdrnec
gdrnec earned 250 total points
ID: 12193767
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
 
LVL 4

Expert Comment

by:gdrnec
ID: 12193774
Oooops. Didn't think about the homework thing. If this is homework, shame on both of us.

My appologies.

Geoff
0
 
LVL 37

Expert Comment

by:zzynx
ID: 12193815
>> 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
 
LVL 4

Expert Comment

by:gdrnec
ID: 12193866
Quite.

;)
0
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 12194286
>>  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
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 12197678
strange, zzynx have already given the idea to you.
0
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 12197695
you could have split the points to both guys

Regards
Sudhakar
0
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 12197701
and also you have accepted wrong comment .
0
 
LVL 92

Expert Comment

by:objects
ID: 12198188
0
 
LVL 92

Expert Comment

by:objects
ID: 12198194
0
 

Author Comment

by:sraveend
ID: 12200020
Iam extremely sorry for using homework question!

0
 

Author Comment

by:sraveend
ID: 12200032
Hereafter i'll ask quetions with codings,Thanks a lot!
0
 
LVL 37

Expert Comment

by:zzynx
ID: 12200062
Thanks for ignoring me once again!
0
 
LVL 4

Expert Comment

by:gdrnec
ID: 12200096
Hey zzynx,

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

Geoff
0
 
LVL 37

Expert Comment

by:zzynx
ID: 12200140
Hi Geoff,
thanks for your honesty.
I already asked Venabilli to reopen it *once again*.
0
 
LVL 4

Expert Comment

by:gdrnec
ID: 12200428
Not being obtuse here but I don;t see a split points link.

Geoff
0
 
LVL 37

Expert Comment

by:zzynx
ID: 12200480
Geoff, Venabilli's comment is meant for sraveend  (made a name mistake)
0
 
LVL 20

Expert Comment

by:Venabili
ID: 12201694
Yes. Sorry Geoff :(((

sraveend,

Any troubles?

Venabili
0
 
LVL 37

Expert Comment

by:zzynx
ID: 12206449
:)
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question