Friday, February 26, 2016

Java interview questions


The difference between the method sleep and wait

both throws InterruptedException (how to handle InteruptedException?)

Java return and finally - what will be printed out?

public void testFinally(){
   System.out.println(setOne2().toString());
}

protected StringBuilder setOne(){
   StringBuilder builder=new StringBuilder();
   try{
       builder.append("Cool");
       return builder.append("Return");
   }finally{
       builder.append("+1");
   }
}

protected StringBuilder setOne2(){
   StringBuilder builder=new StringBuilder();
   try{
       builder.append("Cool");
       return builder.append("Return");
   }finally{
       builder=null;
   }
}

Wednesday, February 17, 2016

About Marriage and divorce in Ontario

Q We are already married and do not have a marriage
contract. Now we think it might be a good idea to have
one. Is it too late?
A No, it’s not too late. You can sign a marriage contract after you
are married. Remember that it must be in writing and signed by
you and your spouse in front of a witness who must also sign the
contract. If you write your contract yourselves, each of you should
have your own lawyer look it over before you sign it.

Q I am getting married in a few months. I don’t own a lot but I
do have the china set my mother got when she was married.
It is worth about $2,000. When I marry, does the china set
become my husband’s too?
A No. The china is your property. If your marriage ends, you can
keep the china. But if the china has increased in value when your
marriage ends, you and your spouse will share the increase in
value.
If you have a marriage contract, it could say that the china is your
property and that any increase in the value of the china during
your marriage will not be shared with your spouse if your
marriage ends.

If you and your spouse cannot agree on how to settle the
issues between you, you can go to court and ask a judge to decide for
you.

Separation agreements and court orders resolve family matters
when you separate but they do not legally end your marriage. The only
way to do this is to get a divorce. Only a court can give you a divorce.

It’s my wife’s fault our marriage is over. She started seeing
someone else and has decided that she wants out of the
marriage. Why should I have to share the value of my
property with her now just so this new guy gets it?
A Your spouse’s new relationship has no effect on the division of
property at the end of your marriage. The law on dividing family
property has nothing to do with why your marriage has ended.
The law sees a marriage as an equal partnership. When it is
over, the financial benefits of the partnership have to be divided
evenly and fairly. The calculations are made without looking at
who is at fault or who is to blame.

Usually a spouse's behaviour does not affect how property is divided.