User Tools

Site Tools


qtr_2_study_guide

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
qtr_2_study_guide [2019/12/03 14:48] cthielqtr_2_study_guide [2019/12/03 14:51] cthiel
Line 13: Line 13:
  
 Things to watch out for: Things to watch out for:
-  - not initializing a field ( fields are private, to encapsulate)  +  - Constructors should initialize the class' fields  (fields are ''private'', to encapsulate)  
-  - accidentally making a local variable instead of initializing a variable  +  - When initialzing fields in a constructor, **Do not** mention its type- this accidentally makes a local variable instead of initializing the classes field that has the same name. 
-  - remember to make methods public, and don't forget to use () for the parameter list, even if there are none +  - Remember to make fields ''private'' and methods ''public'',  
-  - local variables are never public nor private +  - Remember local variables are **never** public nor private 
-  - dangling else statements (p 148) +  - Remember method names should use () for the parameter list, even if there are no parameters 
-  forgetting to have a method return something of the correct type  +  - Watch for dangling else statements (p 148) - without brackets, the last ''else'' belongs to the previous ''if'' 
-  - not to add a System.out.print were no printing is requested (This can be a 1 or 2 point 'Extraneous code that causes side effectpenalty on the AP Exam) +  - **Do not** add a ''System.out.print'' when no printing is requested (This can be a 1 or 2 point **Extraneous code that causes side effect** penalty on the AP Exam) 
-  - using local variables that you don't declare ( also a AP scoring penalty) +  - **Do not** use local variables before first declaring them ( also a AP scoring penalty).   
-  - changing a value referenced by parameter or destroying data in a parameter (also a scoring penalty) +  - Variables are declared ONLY ONCE, not every time. 
-  - return statement on a constructor, or a method that isn't supposed to return something (a 'void' method).  This too has a AP scoring penalty)+  - **Do not** assign a value to a parameter inside a method unless you are asked to (also a AP scoring penalty called **Destruction of data**
 +  - **Never** use ''return'' in a constructor 
 +  - Remember to ''return'' something of the same type as a method's header.  
 +  - **Do not** ''return'' something when writing a ''void'' method ( a method that isn't supposed to return something (This too has a AP scoring penalty)
    
 Finally, please remember to get a good night's rest and a healthy breakfast! Finally, please remember to get a good night's rest and a healthy breakfast!
qtr_2_study_guide.txt · Last modified: 2023/11/25 12:28 by frchris

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki