This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes String Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "String" Watch "String" New topic
Author

String

akhilesh bar
Greenhorn

Joined: Sep 10, 2010
Posts: 4
hi to everybody...
please tell me that why does Java takes input in the form of String??


@ {< {< !
Devaka Cooray
ExamLab Creator
Saloon Keeper

Joined: Jul 29, 2008
Posts: 3023
    
  35

akhilesh bar wrote:why does Java takes input in the form of String??

What input? If the input is a text, String would be the best way to get it because String can hold a text.


Author of ExamLab ExamLab - a free SCJP / OCPJP exam simulator
What would SCJP exam questions look like? -- Home -- Twitter -- How to Ask a Question
akhilesh bar
Greenhorn

Joined: Sep 10, 2010
Posts: 4
hi devaka..

according to my knowledge... java takes inputs as a string and then converts it into the desired type...for example static void main(String [] args) !!!
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

You're referring to command-line arguments. That's because java uses the String to hold text.
"Input" is very imprecise. Could you specify what do mean exactly.


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11170
    
  16

because anything and everything you type from a keyboard CAN be represented as a String...but the same isn't really true for other variable types.

That's what I've always thought.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Ninad Kuchekar
Ranch Hand

Joined: Jan 05, 2010
Posts: 64
Hi Akhilesh,

Please be specific with your subject...thanks in advance.

If you are passing arguments from the console then they have to be accepted as text(in this case String format).
Even if you type in a number you have to parse the String to the desired format.

Don't walk as if you rule the world, walk as if you don't care who rules it...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: String
 
Similar Threads
Tech Word Game
date format with MS Access database
ResultSet to Array
WA #1.....word association
How to convert byte array into string array?