Mark Ii

Ranch Hand
+ Follow
since Oct 25, 2018
Mark likes ...
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
4
Received in last 30 days
0
Total given
2
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
Ranch Hand Scavenger Hunt
Greenhorn Scavenger Hunt

Recent posts by Mark Ii

Hi! Mr. Ritchie how about the following code? What do you think? Please feel free to let me know.



3 years ago
From Runestone's Interactive Python Tutorial there is a section where you can use Turtle to draw fun graphics. You can try to introduce them to graphics first so they see how cool programming can be.

Here is a chapter and URL of second chapter from that website. It's very fun. It's interactive also. You can code yourself if you want to.

Runestone Interactive Python Turtle Graphics: Our first Turtle Program

Python is a very simple programming language. I enjoyed the tutorial. And loved the programming language.

3 years ago
You can try the following code to do the same thing.


3 years ago
Sorry I posted too quickly. But this is one of the methods you can use. I know you don't want this way but if you do then this is the way. Sorry.

3 years ago

Campbell Ritchie wrote:

Mark Ii wrote:. . . postfix increment operator is used. b is assigned the current value of n first which is 1 then n is incremented. . . .

Afraid that is incorrect. The increment to n occurs first. But the value of n++ is not incremented, i.e. n++ has the old value of n.



Thank you for the correction.
3 years ago

Tomhmas Smith wrote:I am trying to create a code that would populate an array with prime numbers. However, when executing, the answer I get is 12345 instead of  2357 and I cant understand where did I miss the connection between methods.





3 years ago

Annet Rose wrote:My 12 years old child is interested in programming and would like to learn it. How can I teach him coding?



Below you will find a link.

Tutorials and Apps for Children's coding


Hope it helps.
3 years ago

Jonathan Barry wrote: Hi, I'm a complete newbie attempting to learn Java.  This is a task from codegym that I've solved
   but I don't understand why the answers are what they are.  I'm sure I'm missing something obvious,
   but I would like some help understanding how this has an output of 12 and 2?  X is equal to 10 if I
   am deserving of graduated first grade.  What am I missing?


Thanks for your help.

John



3 years ago

Cosmid Constantine wrote:Hi,

Sample program:
 n = 0;
 a = ++n;
 b = n++;

If the post-increment or post-decrement operator has higher precedence than the pre-increment or pre-decrement operator, then why b didn't get a value of 2? I mean, it would make more logical sense if a = 0 and b = 2 with the precedence of the two.

I guess my question is, if n++ has higher precedence, why didn't it apply the ++ effect sooner than the ++ on the ++n? Is this just a special case in Java?

Thanks



Here n = 0; that's clear. n is given the value 0. Okay then a = ++n; which means prefix increment operator is used. Here a is assigned the value after n has been incremented by 1. So a is equal to 1 now. Then b = n++; postfix increment operator is used. b is assigned the current value of n first which is 1 then n is incremented. Now n is equal to 2 and b is equal to 1

And if you do like this:




You can see the result now.
But if you had



All by itself it doesn't matter. n will be incremented anyways.
But for n++; it is expensive for huge numbers.

n is evaluated first then n is incremented.
But if you had

++n;

It is little bit less expensive for huge numbers.

Why you should avoid postfix operator?

I hope it helps.

3 years ago

Jesse Silverman wrote:I feel like I know a lot of true statements that have remained true about the "String Literal Pool" or the "String Constant Pool", as I see it variously called in different posts and articles, even within this forum.  If I understand correctly, the behavior has zero dependence on what you compile with, and solely on which JVM is running the code, what's more, I suspect that this all changed ten years ago and is only confusing people because there is so much stale information about SCP out there in old tutorials and archived discussions and old mock exam questions.

My current belief is that the following statements from the certainly great-at-the-time but possibly no longer quite true tutorial on this site may have become inoperative:

When a .java file is compiled into a .class file, any String literals are noted in a special way, just as all constants are. When a class is loaded (note that loading happens prior to initialization), the JVM goes through the code for the class and looks for String literals. When it finds one, it checks to see if an equivalent String is already referenced from the heap. If not, it creates a String instance on the heap and stores a reference to that object in the constant table. Once a reference is made to that String object, any references to that String literal throughout your program are simply replaced with the reference to the object referenced from the String Literal Pool.

A downstream conclusion from this fundamental explication that I believe is no longer applicable now is:
Strings created at run-time will always be distinct from those created from String Literals.

It is my current belief that the String Constant Pool seems to now be built up during code execution, so that if a String Literal that the JVM is considering adding or looking up in the pool has already been added to the heap and then the SCP by executing user code, it will choose that very one as the reference to add to the String Literal Pool.  In the old days, as this was done before a single line of user code executed, at class loading time, that would never ever happen.

The reason this matters so much (or at all) is that the simple downstream conclusion mentioned both in that article and many other places that exam-preparers are reading is no longer operative.  Instead, it instead now depends on whether the code creating the string that is only created at runtime executes before the line that references the string constant!

I never loved these questions about "how many String objects get created?  Where?" which I see from some sources are indicated to be much more common in preparatory materials and mock exams than on real exams.



Referenced "Was-Great-At-The-Time-But-Confusing-To-New-Exam-Takers-Now" article from this site:
https://javaranch.com/journal/200409/ScjpTipLine-StringsLiterally.html



I second Jesse Silverman. What he said makes much more sense to me. Thank you.

Hanna Roberts wrote:

Mark Ii wrote:. . .



Thank you, This code almost worked as well. The last two in my book fails though I'm not sure why. Thanks for your help though I appreciate it.




You are welcome. You said my code almost works. Can you kindly please give situations where it does not work so that I can write you a better version of the code?
4 years ago
Try this instead. I saw your effort in figuring out the code. So thought why not just help you. I am more into helping a person in need. Extremely sorry for my attitude. That is why I am posting the code. Let me know if you wanted this code this way. Or otherwise, you could use the StringBuilder class from Java built-in library and print the string like the other kind and generous forum member showed in the posting.




Input:



Output:

4 years ago

Carey Brown wrote:NEVER EVER close a Scanner object that has been created from System.in. This will cause System.in to get closed which is a bad thing. Some IDEs complain if you don't close all Scanner objects but in this case you don't want to do it.



To tell you the truth I never in my life closed System.in Scanner object. This is the first time doing it.

My eclipse IDE latest version of Java 13 sdk was giving a warning. So had to close it. Thank you for clearing that out.
4 years ago
I need some good recommendations here.

Where can I find a good Java 8 SDK Certification training course with the duration of one semester in Scarborough, Ontario (Canada)?

Summer is at the doorstep. Does Centennial College or Trios College have any dedicated one-semester course starting from the summer of 2020? Are they any good?

Can anyone have any experience with this in Scarborough?

My main criteria are that I will get the best value for my money, have hands-on experience, and have to write regular tests and quizzes to better grasp Java SDK 8.

Also, I would like to know what are the different Java 8 SDK certification exam types and their designations? Moreover, what's the easiest and basic exam for Java SDK 8? What version of SDK is covered for that exam? Where can I find more information about that particular exam?


Thank you.


How about this one? I created a class method.


4 years ago


vceplus-200-125    | boson-200-125    | training-cissp    | actualtests-cissp    | techexams-cissp    | gratisexams-300-075    | pearsonitcertification-210-260    | examsboost-210-260    | examsforall-210-260    | dumps4free-210-260    | reddit-210-260    | cisexams-352-001    | itexamfox-352-001    | passguaranteed-352-001    | passeasily-352-001    | freeccnastudyguide-200-120    | gocertify-200-120    | passcerty-200-120    | certifyguide-70-980    | dumpscollection-70-980    | examcollection-70-534    | cbtnuggets-210-065    | examfiles-400-051    | passitdump-400-051    | pearsonitcertification-70-462    | anderseide-70-347    | thomas-70-533    | research-1V0-605    | topix-102-400    | certdepot-EX200    | pearsonit-640-916    | itproguru-70-533    | reddit-100-105    | channel9-70-346    | anderseide-70-346    | theiia-IIA-CIA-PART3    | certificationHP-hp0-s41    | pearsonitcertification-640-916    | anderMicrosoft-70-534    | cathMicrosoft-70-462    | examcollection-cca-500    | techexams-gcih    | mslearn-70-346    | measureup-70-486    | pass4sure-hp0-s41    | iiba-640-916    | itsecurity-sscp    | cbtnuggets-300-320    | blogged-70-486    | pass4sure-IIA-CIA-PART1    | cbtnuggets-100-101    | developerhandbook-70-486    | lpicisco-101    | mylearn-1V0-605    | tomsitpro-cism    | gnosis-101    | channel9Mic-70-534    | ipass-IIA-CIA-PART1    | forcerts-70-417    | tests-sy0-401    | ipasstheciaexam-IIA-CIA-PART3    | mostcisco-300-135    | buildazure-70-533    | cloudera-cca-500    | pdf4cert-2v0-621    | f5cisco-101    | gocertify-1z0-062    | quora-640-916    | micrcosoft-70-480    | brain2pass-70-417    | examcompass-sy0-401    | global-EX200    | iassc-ICGB    | vceplus-300-115    | quizlet-810-403    | cbtnuggets-70-697    | educationOracle-1Z0-434    | channel9-70-534    | officialcerts-400-051    | examsboost-IIA-CIA-PART1    | networktut-300-135    | teststarter-300-206    | pluralsight-70-486    | coding-70-486    | freeccna-100-101    | digitaltut-300-101    | iiba-CBAP    | virtuallymikebrown-640-916    | isaca-cism    | whizlabs-pmp    | techexams-70-980    | ciscopress-300-115    | techtarget-cism    | pearsonitcertification-300-070    | testking-2v0-621    | isacaNew-cism    | simplilearn-pmi-rmp    | simplilearn-pmp    | educationOracle-1z0-809    | education-1z0-809    | teachertube-1Z0-434    | villanovau-CBAP    | quora-300-206    | certifyguide-300-208    | cbtnuggets-100-105    | flydumps-70-417    | gratisexams-1V0-605    | ituonline-1z0-062    | techexams-cas-002    | simplilearn-70-534    | pluralsight-70-697    | theiia-IIA-CIA-PART1    | itexamtips-400-051    | pearsonitcertification-EX200    | pluralsight-70-480    | learn-hp0-s42    | giac-gpen    | mindhub-102-400    | coursesmsu-CBAP    | examsforall-2v0-621    | developerhandbook-70-487    | root-EX200    | coderanch-1z0-809    | getfreedumps-1z0-062    | comptia-cas-002    | quora-1z0-809    | boson-300-135    | killtest-2v0-621    | learncia-IIA-CIA-PART3    | computer-gcih    | universitycloudera-cca-500    | itexamrun-70-410    | certificationHPv2-hp0-s41    | certskills-100-105    | skipitnow-70-417    | gocertify-sy0-401    | prep4sure-70-417    | simplilearn-cisa    |
http://www.pmsas.pr.gov.br/wp-content/    | http://www.pmsas.pr.gov.br/wp-content/    |