• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java Clarification

 
Deepak Lal
Ranch Hand
Posts: 561
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Campbell Ritchie
Sheriff
Pie
Posts: 49472
64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 561
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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"!
 
Campbell Ritchie
Sheriff
Pie
Posts: 49472
64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20559
57
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Campbell Ritchie:
I'm glad you thought the references were excellent, Rob.

 
Deepak Lal
Ranch Hand
Posts: 561
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20559
57
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 49472
64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The alphanumeric checking is actually easy; you can write a class which does that in � hour.
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 49472
64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 561
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 49472
64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 49472
64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Go through the Character class; you will find all sorts of useful methods which will help you out.
 
Deepak Lal
Ranch Hand
Posts: 561
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
which methods of Character Class will be helpful to check for alphanumeric....please suggest....hint provided will be highly helpful....
 
Campbell Ritchie
Sheriff
Pie
Posts: 49472
64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Go through them and start by looking for their return types. Start here. Guess which return type you are looking for.
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic