Solved

java programming

Posted on 2004-09-30
24
219 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
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
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
 

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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Suggested Courses

631 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