« first day (958 days earlier)      last day (4205 days later) » 

user1174868
01:28
I am stupid
user1174868
how do I have classes in a main?
user1174868
I can't figure it out, always get errors "start of an illegal expression"
user1174868
public class Test { public static void main (String args[]){ class 1 {} class 2{} }} why is that wrong?
15:20
@Jordan you can't declare classes inside of methods unless if they are anonymous
 
4 hours later…
19:46
@pinkpanther let me know when you are here
hi smit
@pinkpanther Hi
OKay so waht we were discussing>
why are you thinking java is pass by value?
Because in java when we call any method it passes the value and not the reference.
There is no pointer concept in java
we should say there are no explicit pointers in java
references are nothing but pointers
for example
when you call java with a BufferedImage object
that object is reference
19:50
yes but we pass copy of reference as value and not the actual reference.
In C or CPP you pass actual location of memory.
any changes you make in called method will also reflect in calling method.....
it's the same way
I will take String as an example
first of all
no
okay
that's not a good example
you explain
ok
let's think we have a class point
in that class we have x and y variables
19:52
okay
x and y are class members rt?
now create a method changeX(Point p,int x);
instance variables..x,y
create a new object point
okay
assign p.x=2;
p.y=3;
okay
print them
now call changeX(p,3)
now print them again
you will get p.x=3
that means they are changed in memory
no copying is done....just the reference is passed
19:54
YEs cuz you are working with class level members.
it could be the memory location in low level terms
reference means
OKay. hold on
yeah
tell me
do you remember small swapping program in C by pointer and with out pointers
19:56
Try to do that by java.
you will be surprised
I think I know what's going to happen
because they are primitive types not objects
primitive types in java are call by value
no its same with non primitives if you pass an object through method, the n you are passing the copy of object as value and not actual object. Thats why its pass by value
@Kneel-Before-ZOD THIS MUST BE FOLLOWED area51.stackexchange.com/proposals/56143/facial-hair
@Washu Hi
Can you shade some light on is java pass by value or pass by reference
@Smit let me tell you one thing
19:59
@Smit hi
@pinkpanther yes
you can check it by printing hashcode of an object in both methods
got it what I'm telling
?
@pinkpanther NO
int hashCode()
Returns a hash code value for the object.
okay
20:02
print the the object.hashCode() in both calling and called methods you will get same values
same value
Yes they will for sure
that itself tells us that they are not copied but the same objects
cuz they both are point to same thing. but when its gets returned and when it gets collected as value, sender and collctor are two different but they point to same location.
yeah both point to same thing means what? point to the same location....!
so object copying is not done
....
I am not sure how to explain you, but you pass everything in java as value ans not as reference
20:05
you have given me this link that itself explains you
Java does manipulate objects by reference, and all object variables are references. However, Java doesn't pass method arguments by reference; it passes them by value.
I though you didn't get it and by this
1 down vote


Java is a pass-by-value, when you pass a primitive\wrapper you will pass its inner value, and when you pass an object (a reference) you will pass its value (which is the address of the object it references in the memory).
you got it correctly....
you will pass its value (which is the address of the object it references in the memory).
that part made me say what I said..... cheers :)
739
Q: Is Java "pass-by-reference"?

user4315I always thought Java was pass-by-reference; however I've seen a couple of blog posts (e.g. this blog) that claim it's not. I don't think I understand the distinction they're making. Could someone explain it please?

now it's ok
thank you very much.....
it's been a good day for me
So you thing java is pass by reference
or pass by value
you will pass its value (which is the address of the object it references in the memory).
YEs
20:11
but I couldn't understand how that's called pass by value
ok I got it
cuz you dont pass actual object.
we pass actual object
you pass copy of it as value
by saying this...
do you mean that....
say
object of
10 KB memory
on passed
another object of 10KB memory is created?
NO
20:13
ok that's ok
I know its very confusing
it seems the problem with terminologies than concept
yeah really
and I coulnt able to give you enough info
gotta see it tommorrow....
sure
I am aslo heading for lunch
See you soon..
20:14
you are heading for lunch and it's 1:44 AM here
you should say good night to me.....
its 1:14 PM here
Good Night...
where are you from
I am ON PST
good afternoon
PST?
Good NIght
See you aroiund
20:15
ok bye
string A = "Good NIght";
Pacific Standard Time
A=="Good NIght" returns false
:O
@Lucio why?
20:56
That is the point. Why..
It is not consistent and it will never be.
21:25
hey gusy
i have a question
I'm new in java programming, in fact, I'm about to start learning it
What is the best book for me
I have experience in web developing using php ... and i know oop programming.
I don't need a book like "head first " books.
But i don't need a complex book either
 
1 hour later…
22:36
@Siamak.A.M you only know php?

« first day (958 days earlier)      last day (4205 days later) »