
-----------------------------------
wtd
Mon Oct 03, 2005 11:25 am

Java Trivia
-----------------------------------
Let's see how good the resident Java gurus really are.  :)

Two true or false tests.

In Java, all object types are passed by reference.

Java does not have pointers.

-----------------------------------
rizzix
Mon Oct 03, 2005 11:40 am


-----------------------------------
True. True. (although java references can contain null values and are re-assignable, it really depends on ur definition of a pointer/reference.. in my books a pointer is somthing to which u can directy assign a physical address as in C-pointers.)

-----------------------------------
wtd
Mon Oct 03, 2005 11:55 am


-----------------------------------
False and false.  :)

public class Test
{
   public static void main(String

Compare to:

#include 
#include 

void foo(std::string& s)
{
   s = "Hello";
}

int main()
{
   std::string str("Foo");
   std::cout str = "Hello";
}  

int main()
{
   A *a = new A;
   std::cout str 