Guys, My last two posts on this topic has been messed up with some other posts,I m trying it again with another subject without any formatting or tag,hope it goes thru,pls let me know the answer of the prob. If you see "Thanks God its done" msg at the end of post ,means this time post is OK,
So prob is
Seems a little thing , but I have missed this in last 5 yrs,Say I have a class with a public element sat int in it,
public class First{ public int i; }
and another class which access this public element of first class(say it prints this elemnts value in m (or Go-Moku) itself is not a simple game or that the masters of this game are not brilliant and talented game players who have acheived an amazing level of skill. Playing the game at the highest levels involves dealing with enormous amounts of complexity. However, the basic elements of the game are quite simple and the complexity comes from the size of the playing field and the number of combinations that stems from that.
Also, with Go and other games, the search tree doesn't constitute AI; usually the AI, if present, is involved mostly in the evualation algorithm for each position (and to some extent, which branches are further examined based on that). With a simple game like Go-Moku, you can have a prefectly good and very strong engine without any AI at all.
it got messed up again,here is the remaining portion of my post,just after the First class defination of above class(repating class First defination),pls check it out and let me know y its happening
public class First{ public int i; }
and another class which access this public element of first class(say it prints this elemnts value in main).Perfectly legal,isnt it?
public class Second{ public static void main(String []){ System.out.println(new First().i); } }
Now if I change this public int element of class First and recompile only class First and the run the second class ,it still prints the value of i , which is private now in class A defination.
SO pls let me know , how class second is still able to access Class First's private element, I have checked it also by moving both classes to different packages(though i know private cant be accessd even within same package)
Regards, Rohit "Thanks God its done"m.out.println("The triangular number is: " + triangle
When class Second was compiled for the first time then i was accessible in First and it had public access. When you changed the access of i in First and didn't recompile Second then SEcond still has the access to i as public. Even though you have changed access to i as private. This change has made two classes incompatible and you need to recompile the Second class. It seems strange and you may think why Java is allowing access to i when it is private. JLS describes these issues in details. Please read the JLS Chapter 13 following the above link and you will find many surprises like yours.