March 6, 201214 yr 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]
March 7, 201214 yr 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
Create an account or sign in to comment