oh ok.. thanks. nag-libog lang ko gud.
Happy Java Programming... BTW essential raba na nga part sa OOP. Master it!.Originally Posted by ares623
^^^ OMG it's my bro's account! Gamit ko sa iyang PC yesterday. Wala ko'y idea nga iyang account akong nagamit.
Anyway that is me replying to ares623.
hehe. lagi, practice jud ko maayo ani. maka-lingaw pud bya..
post2x lang nya ko diri kung naa ko questions. thanks cen.
Ur welcome bai. Lipay ko daghan2x nako mga kaila nga java programmers diri cebu.Originally Posted by ares623
Mostly mga kaila og batch nako nga mga java programmers wala na diri sa cebu.
Anyway arrays in java are also a reference.
Ex.
a is a reference to an array of 10 integer.Code:int a[] = new int[10];
^so mao ra gihapon na? if i pass a to a method, it'll change it's value?
maayo bah mag-sige og gamit og pass-by-reference sa java?
dili pa man ko Java programmer jud bai. hehe. IT student ko nya Java man mi ron, na-ganahan man ko mao ako ni tun-an jud. hehe.
Yup. Same ra. It will change the the values of a. As long as dili ka mag-instantiate (meaning mag-allocate og new array).Originally Posted by ares623
Ang title nga "Java Programmer" applied na sa ni-program og java.
Walay pass by reference sa java.....its always pass by value.....
To elaborate....during runtime, passing a primitive data type to a method such as char, int, long, float, double, etc the virtual machine will allocate a new memory location for that data type and will place the value being passed on that memory location. That goes the same with object data types like String, Integer, Double, Float. But you should take note, that in the case of the object types, the value that is actually pass to the method is the memory location of the object on the memory space called the heap and not the object itself.
Originally Posted by ares623
as far as i remember, only objects are passed as reference. primitive ones are not. primitives are loaded in the stack and not in the heap memory.
sakto si bcasabee about sa parameter passing sa java..
Similar Threads |
|