Status
Not open for further replies.

~Phenom~

The No.1 Stupid
Hi friends ,
Just want to know answers to two questions:
1.How to use command line arguments in C?
2.Does Java support operator overloading???Support your answer.

I know many of u people know the answer, please reply...
 

Vishal Gupta

Microsoft MVP
1.) Following links will help u:

*www.cs.caltech.edu/courses/cs11/material/c/mike/misc/cmdline_args.html
*www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=9874&lngWId=3
*www.tutorialized.com/tutorial/Command-Line-Arguments/4260

2.) No! Java doesnt support Operator Overloading except the String Concatenation "+".
 
OP
~Phenom~

~Phenom~

The No.1 Stupid
Thanx for the links vishal , u r always supportive.
But I m still not convinced with the second answer. I have read everywhere that Java does not support operator overloading but then I saw "+" being overloaded. That confuses me . How can a property be there but be just limited to "+" ???
 

Vishal Gupta

Microsoft MVP
Read here what Guy Steele said about operator overloading:

*java.sun.com/features/2003/05/steele_qa.html

Overloaded operators are still a subject of controversy. They are almost indispensable for certain
kinds of mathematical work, but people who oppose adding them to the Java language point out, quite
rightly, that the feature was badly abused in C++ for nonmathematical purposes, making code much
harder to read than necessary. Most Java applications are nonmathematical in nature. One could make
a good argument that commercial applications have no need for operator overloading, except that
commercial applications do use (or should use) BigDecimal arithmetic, and it would be really nice
to be able to use + and - and * and / with BigDecimal numbers. Much the same can be said of so-called
"lightweight classes": their greatest value would lie in supporting numerical concepts such as
complex numbers and interval arithmetic.

We have an interesting decision to make that is more a political or business question than a
technical one: should the Java language be extended to support the needs of mathematical
applications? If so, then I would argue strongly for introducing operator overloading and lightweight
classes -- I'm pretty sure such facilities would also get used for other purposes. If not, then
maybe we should just make + and - and * and / work for the BigInteger and BigDecimal classes as a
special case, much the same way that + is already a special case for the String class.
I found it interesting while googling for the reason behind it:

*onthethought.blogspot.com/2004/11/java-and-operator-overloading.html
 
Status
Not open for further replies.
Top Bottom