nadeem shake

Greenhorn
+ Follow
since May 01, 2013
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
2
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by nadeem shake

Winston Gutkowski wrote:

nadeem shake wrote:...and its not frustrating for people to help if they really want to help...


You wanna bet?

It very much depends on what your expectations are. If you're prepared to put in the time and effort to learn - and I have no reason to think you won't - and also to ask questions in a clear and precise way (have a look at the HowToAskQuestionsOnJavaRanch page, because there's a lot to know about it), I'm sure nobody will have any problems at all.

On the other hand, if you simply look on us as a service for answering whatever question comes into your head, you may get some pithy responses.

Anyway, welcome to the Ranch, and the best of luck with your studies.

Winston



it is not any whatever question that came into my head , it was a question that i was unable to get answer on my own that's why i asked here. and i dont look at this forum as a service but as a means of help and guidance nothing more and nothing less.


8 years ago

Jesper de Jong wrote:

nadeem shake wrote:the question still remains in my stupid mind that how does the compiler come to know there are two methods with the same name but with different return types , does it do this checking during compile time ???


Ofcourse the compiler checks that at compile time. It analyzes your source code and sees that the met1() method in class Test39 has a different and incompatible return type (int) than the met1() method in its superclass Temp (void).



Thanks a lot for clearing my doubt !!! i really appreciate that
8 years ago

Winston Gutkowski wrote:

nadeem shake wrote:...and i hope that i can learn java from this forum and i have joined this forum with that intention in my mind...


My advice: Don't think that you can learn Java from this forum.

If you really are trying to learn on your own, you really should get a decent book - this one has a very good reputation - or read the Java Tutorials and follow the exercises thoroughly.

We can help with advice if you run into difficulties; but trying to learn a language as complex as Java from a forum like ours will be time-consuming and frustrating for both you and us.

Winston



i would like to say that i have 2 books on java , the book that you mentioned i already own , I just ask when i am not able to understand a concept from the book or if i have some doubt , i am not asking anybody to be my tutor here i just ask for small helps when i run into trouble even after reading books and all , and its not frustrating for people to help if they really want to help . thanks
8 years ago
I have a question related to the below code .

the question is : i think that when i create the object "Temp x = new Temp();"
and call the method using " x.met1();" it should call the method inside the subclass Test39 which is "int met1()" , i think this way because i am creating the object for that particular class which is Test39,

but it gives me an error stating

Test39.java:9: met1() in Test39 cannot override met1() in Temp; attempting to use incompatible return type
found : int
required: void
int met1()

i understand that the int should be changed to void to remove this error because i am trying to override the void met() method which is inside the
temp class, but the question still remains in my stupid mind that how does the compiler come to know there are two methods with the same name but with different return types , does it do this checking during compile time ???



sorry guys if this is a stupid question i have no one to ask to so i am asking here and i hope that i can learn java from this forum and i have joined this forum with that intention in my mind . thanks guys for the support



8 years ago
Now I get it thanks a million you've realy made my day, once again thank you !!!
8 years ago
But according to the code when i create the new object
Test29 d = new Test29();

it should call the constructor with no parameters which is this

public Test29()
{

this("unknown");
}

somehow i fail to understand !!! please help
8 years ago
according to me when this("unknown") is called , it will in turn call the main constructor

public Test29(String n, int s)
{
name = n;
salary = s;
System.out.println("The name entered is ="+name+"and the salary is ="+salary);
}

and "unknown" gets passed into "String n" but i don't get what is passed to "int s"
8 years ago
hii thanks for replying , i will surely follow your guidelines the next time i post,

ok according to me "Test29 d = new Test29(); " should call the last unparametrised constructor

public Test29()
{
this("unknown");
}

but as i am passing just "unknown" i dont understand why the 0 comes in salary.

8 years ago

output:

The name entered is =ABCand the salary is =0
The name entered is =unknownand the salary is =1000
The name entered is =xyzand the salary is =2000
The name entered is =unknownand the salary is =0


i need to know why do i have the last output as unknown and 0
8 years ago