O Shea

Ranch Hand
+ Follow
since Jul 19, 2017
O likes ...
Oracle MySQL Database Java
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
3
In last 30 days
0
Total given
0
Likes
Total received
30
Received in last 30 days
0
Total given
41
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by O Shea

Better to got to IEEE and search on the google regarding the topics on which you want to perform.
If you don't know any topics, then just Google them out, or take any topic according to your area of interest.
6 years ago
Hi Mark, Welcome to JavaRanch.
Congratulations Champion on your big success
6 years ago
Welcome Emre to the JavaRanch.

Well according to your question, you haven't mentioned that what you have passed as Command Line Argument, whatever you passed as Command line argument that is stored inside the String[] args parameter of the main method.

So, here I am assuming that you haven't passed anything, then your answer is Infinite Loop, since I>=0(for all i from 1 to infinite) this condition is remains true forever and hence it is a infinite loop.
Congratulations champion, for achieving this success.
Hi Harshad, Welcome to JavaRanch.
Congratulations Champion on your success
6 years ago

Stephan van Hulst wrote:When you get an exception that you don't know how to deal with, always copy it so people know what's going wrong.



Definitely, i will take care about it, next time.

Stephan van Hulst wrote:
it's likely that the modulus operator isn't defined for floating point operands.



Ok, thank you very much.
6 years ago
Hello Ranchers, I want to ask about this Simple Calculator program which is in C language



Can anyone please tell that why I am getting the error at the case of Modulus operator ?

Thanks in Advance
6 years ago
That's great, still there is big demand for 051 exams, but I don't know why, since it won't give you any certification. Instead of doing this, it is better to do 071, it gives certification and it is just 1000 rupees extra then 051 exam.

Well, thanks for the link, it will definitely help for preparing the exam.
This, question is related to static as well as instance control flow.

Following is the order of execution whenever any program is executed->

1) First identification of static members from top to bottom-> In your example it is Line number 3,9,16
2) Next we have execution of static variable assignments and static blocks from top to bottom -> So, line 9 gets executed and you got 4
3) Then we have execution of Main Method
 
Now, in in Main we have an object created so as the object created then following happens->

4) First identification of instance members from top to bottom-> In your example it is Line number 12
5) Next we have execution of instance variable assignments and instance blocks from top to bottom -> So, line 12 gets executed and you got 5
6) Then after executing instance members we have Constructors gets executed -> So, line 6 executed and you got 3
   
That's it, overall output is-> 4,5,3

Now Case 2-> When you don't have this line->
It, means that the object won't be created hence from above only steps 1,2,3 executed and steps 4,5,6 are note executed.
That's why output is 4 only

Note-> Static members executed only ONCE , at the time of class loading, but instance members are executed for each object created.




@ Cm Luk, congratulations, on your big success, now take a bit of relax, and then move to your next target.
Many many congratulations, on your big success
6 years ago
Congratulations Jeanne, you are really a role model. That's great.
See, Mala Gupta is also there.
6 years ago

Stephan van Hulst wrote:The second link is full of mistakes (for instance, you can have parameterless constructors that are not the default constructor, and constructors are not special types of methods) and also doesn't define the term "copy constructor".

It doesn't matter. In Java, you can write constructors that copy an object. Any comparison with how a language like C++ does it is meaningless.


Thank you very much for clearing my doubt.
6 years ago

Stephan van Hulst wrote:To have any meaningful discussion about this topic, you have to define what the term "copy constructor" means. My definition is a constructor that makes a copy of an object. According to that definition, you can create copy constructors in java. Does any other definition really matter? The outcome and use cases are the same.



I am confused regarding these 2 references->

This site is saying that there is a copy constructor in java-> Site 1

This site is saying that there is no copy constructor in java-> Site 2

That's why I am confused according to these 2 sites.
6 years ago
But, still I have doubt that in java also, Copy Constructor is doing it's task perfectly i.e, copy the value of 1 object to another.
However in C++ it is done by passing the reference variable itself(i.e, pass by reference), but in java it is done by passing the copy of reference(i.e, pass by value).
So, how can we say that Java, won't support Copy Constructor???
6 years ago