Tuesday, November 18, 2008
Reference variable vs. Real object
======================== Code ========================
public class Sub extends Super{
int x = 15;
static int y = 25;
public static void main(String args[]){
//super reference and super object
Super t = new Super();
out.println(t.x + " " + t.y);
t.methodOne();
t.methodTwo();
//super reference and sub object
Super ts = new Sub ();
out.println(ts.x + " " + ts.y);
ts.methodOne();
ts.methodTwo();
//sub reference and sub object
Sub s = new Sub();
out.println(s.x + " " + s.y);
s.methodOne();
s.methodTwo();
}
static void methodOne() {out.println("Sub methodOne()");}
void methodTwo() {
out.println("Sub methodTwo()");
methodOne();
}
}
class Super{
int x = 10;
static int y = 20;
static void methodOne() {out.println("Super methodOne()");}
void methodTwo() {
out.println("Super methodTwo()");
methodOne();
}
}
================================================
======================== Answer ========================
10 20
A methodOne()
A methodTwo()
A methodOne()
10 20
A methodOne()
B methodTwo()
B methodOne()
15 25
B methodOne()
B methodTwo()
B methodOne()
================================================
======================== Conclusion ========================
static methods and variables are based on the reference type
Real object type determines which overridden method is used at runtime
================================================
Tuesday, November 11, 2008
SCJP
Uploaded on authorSTREAM by maggie.zhou
Uploaded on authorSTREAM by maggie.zhou
Uploaded on authorSTREAM by maggie.zhou
Uploaded on authorSTREAM by maggie.zhou
Monday, November 10, 2008
SQA
Uploaded on authorSTREAM by maggie.zhou
Tuesday, October 28, 2008
SQL
Uploaded on authorSTREAM by maggie.zhou
IPSec
Uploaded on authorSTREAM by maggie.zhou
Wednesday, October 8, 2008
Ad hoc Network protocols
Uploaded on authorSTREAM by maggie.zhou
Lost root password in MySQL
If you lost the root password of MySQL, there are several to get over it. On Windows, you can use the following steps to reset a new password.
1. close currrent running MySQL: you can go to windows task manager(by press Ctrl+ALT+DEL), and end the process: mysqld-nt.exe
2, open a dos command window
3, set path as your mysql installation path, and into bin, mine is:
c:/program files/mysql/bin
4, Input command:
mysqld-nt --skip-grant-tables
if there is nothing shows up, it means everything is ok
5, Then, you need open another dos command window
6, Still, set the same path: c:/program files/mysql/bin
7, input:
mysql
then press ENTER key, to get into mysql
if you see:
mysql>
then so far so good
8. After the previous steps, please input:
use mysql;
update user set password=password("123456") where user="root";
flush privileges;
12345 is you new password for root user, please don't forget the semicolon and use double quote for both password and user name root
9. Quit mysql by input
\q
10, On Final step, you need to log out then login windows.
Now, you can use the new password to login mysql in the normal way.
