aspose file tools*
The moose likes Beginning Java and the fly likes Java Clarification Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Java Clarification" Watch "Java Clarification" New topic
Author

Java Clarification

Deepak Lal
Ranch Hand

Joined: Jul 01, 2008
Posts: 507

Hi Java Experts,

I have a few clarifications,,seeking some help from your side.

1> what is finalize in java ? when do we use it ?
2> what is Reflection API in java.? Please help me with an Example ?3> what is the difference between HashSet and TreeSet ?
4> Write a Java program for checking of Alphanumeric's? : help needed.
[ October 18, 2008: Message edited by: Bear Bibeault ]

When The Going Gets Tougher,The Tougher gets Going
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40052
    
  28
You should by now know to use a subject which tells what the thread is about.
1 2 3 4 or maybe it's 4 3 2 1.
Deepak Lal
Ranch Hand

Joined: Jul 01, 2008
Posts: 507

Sorry, but I'm unable to find out the answers for the below questions from the link which you had given before.

Please do not provide me links,i have read enough,can you give me the answers for the below queries.

I'm Still

2> what is Reflection API in java.? Please help me with an Example ?

3> what is the difference between HashSet and TreeSet ?

4> Write a Java program for checking of Alphanumeric's? : help needed. (without using Regular expression's )

--
Deepak Lal
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

Deepak, you might need to slow down and take a look at the links. Link number 2 in Ulf's message, for example, is to a tutorial on Reflection. The first sentence on the first page tells what reflection is used for. Likewise, the other links are excellent references for the questions you've asked. Since we don't know your current level of expertise, it's hard to know how to best answer your questions. "What's the difference between HashSet and TreeSet" can be answered in terms of APIs, algorithms, performance, behavior... there are many differences, but we don't know which really matter to you. Under some circumstances, an appropriate answer could even be "there's no difference"!


[Jess in Action][AskingGoodQuestions]
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40052
    
  28
Originally posted by Ernest Friedman-Hill:
Link number 2 in Ulf's message, for example, is to a tutorial on Reflection. Likewise, the other links are excellent references for the questions you've asked.


I'm glad you thought the references were excellent, Rob.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19785
    
  20

Originally posted by Campbell Ritchie:
I'm glad you thought the references were excellent, Rob.



SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Deepak Lal
Ranch Hand

Joined: Jul 01, 2008
Posts: 507

Can you guys please help me out with the below query...I'm unable to find out a solution for the below question....i have also searched various forums....please provide me a logic atleast to proceed further....



1> Write a Java program for checking whether a given string is Alphanumeric or not using Regular expression's ??



2> Write a Java program for checking whether a given string is Alphanumeric or not (Without using Regular expression's ) ??


i have tried a lot on this...but im unable to build my own logic...Please rescue me..... :roll: :roll: :roll: :roll: :roll:

--
Deepak Lal
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

Originally posted by Campbell Ritchie:


I'm glad you thought the references were excellent, Rob.


I have Ulf on the brain, apparently
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19785
    
  20

Originally posted by Deepak Lal:
Can you guys please help me out with the below query...I'm unable to find out a solution for the below question....i have also searched various forums....please provide me a logic atleast to proceed further....



1> Write a Java program for checking whether a given string is Alphanumeric or not using Regular expression's ??



2> Write a Java program for checking whether a given string is Alphanumeric or not (Without using Regular expression's ) ??


i have tried a lot on this...but im unable to build my own logic...Please rescue me..... :roll: :roll: :roll: :roll: :roll:

--
Deepak Lal

What have you done so far? Please Show Some Effort.

As for how to do this with regular expressions, look at java.util.regex.Pattern.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40052
    
  28
The alphanumeric checking is actually easy; you can write a class which does that in � hour.
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by Deepak Lal:
...im unable to build my own logic...Please rescue me...

Deepak, we're trying to help you, but you need to do your part.

If you want to be a programmer (or even if you just want to pass an intro programming class), you need to put your own logic into code. That comes with practice -- not by looking at code someone else has given to you. So please show us the code you've written so far, and we'll help you through the parts you're stuck on.
[ October 18, 2008: Message edited by: marc weber ]

"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by Ernest Friedman-Hill:
... I have Ulf on the brain, apparently

If this is an acute exasperation... uh, I mean exacerbation, I recommend Vicodin. But if it's a recurring obsession, I would opt for Zoloft.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40052
    
  28
Originally posted by marc weber:

If this is an acute exasperation... uh, I mean exacerbation, I recommend Vicodin. But if it's a recurring obsession, I would opt for Zoloft.
If on the other hand, you have Campbell on the brain, I recommend potassium cyanide.
Deepak Lal
Ranch Hand

Joined: Jul 01, 2008
Posts: 507

Hey Guys,I successfully wrote the program.its compiling and working fine...below is the code... enjoy and thanks to all who helped me out with logic


Anyone who has a better logic than the below code is welcomed to share his logic....

Working Code is as below....




If you have a better logic than above please share with me.....
alternative solutions provided will be highly appreciated.



--
Deepak Lal
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40052
    
  28
That should work, and you are correct to try the non-regex solution first.
You should, however, be able to create a solution without a "return" in the middle of the method.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40052
    
  28
Go through the Character class; you will find all sorts of useful methods which will help you out.
Deepak Lal
Ranch Hand

Joined: Jul 01, 2008
Posts: 507

which methods of Character Class will be helpful to check for alphanumeric....please suggest....hint provided will be highly helpful....
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40052
    
  28
Go through them and start by looking for their return types. Start here. Guess which return type you are looking for.
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Learning to use the API is like learning to code your own logic. You won't get any practice if we do the work for you.

The "Character class" is already a big hint.
 
wood burning stoves
 
subject: Java Clarification