Perakp Posted March 6, 2012 Share Posted March 6, 2012 Ok I wanted to ask a little fast question, but realized the question was too stupid to ask. Might aswell find the answer myself since I got the pseudocode written. To make the topic worthwhile, post any small programming puzzles or problems to test one's programming abilities. I'll go first: In Java I have made my own class, that holds one property. It has a method to set that property and another one to print it to the console. Consider the following code. What would it print?Object a = new Object(); a.setProperty(5); ArrayList<Object> list = new ArrayList<Object>(); list.add(a); list.get(0).setProperty(6); a.printProperty(); list.get(0).printProperty(); a.setProperty(4); a.printProperty(); list.get(0).printProperty(); Answer:[hide]6644[/hide] Link to comment Share on other sites More sharing options...
Flyphe Posted March 7, 2012 Share Posted March 7, 2012 haha nice, thats cool. Need to remember pointers... ;) Who else got it right? (I did) There is some good puzzles here, try writing a program that outputs the answer to each question :D http://foohack.com/2008/07/programming-puzzles-and-our-mismatch-problem/ My Blog Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now