2013年11月19日星期二

java in the class declaration of variables Why is placed in a class rather than at the end of the beginning

Such as title, learn C language is always the first to declare variables , to the JAVA program I saw the book are the variable declaration at the end of the class , and why ?
as
import java.util.*;

public class Test
{
public static void main(String[] args)
{

}
}

abstract class Person
{
// Private String name;  为什么不放在开头处?

public Person(String n)
{
name = n;
}

   Private String name;
}

------ Solution ------------------------------------- -------
seemingly c variable declaration in order to use it first , java 's whatever you want in that statement , as long as you really declared . Language that is not the same .
These are described in textbooks are not what ? learn not seriously ah classmates .
------ Solution ---------------------------------------- ----
no hard and fast rules , as long as the statement on the line
put finally just used to it . . .
------ Solution ---------------------------------------- ----
class declaration and initialization sequence order is not the same , and this point you can find online , oh , you check the builder initialization sequence on the line

As for the statement in the back , can only be used to it, are so dry
------ Solution --------------------- -----------------------
Results posted to the sub- ah pro ~
------ For reference only ----- ----------------------------------
ah , thank you.

没有评论:

发表评论