Login:  Password:    
forgot my password
sign up!
Search: 

Sun Certified Java Programmer 310-065-Lesson 8-Assignments-Part 1 | Java courses

In this video, we move into assignments. Our exercises will cover scope, which is the lifetime of an object.

0 0
Course:   Sun Certified Java Programmer 310-065
download the application please visit www.mrbool.com/player

Title: Sun Certified Java Programmer 310-065-Lesson 8-Assignments-Part 1

Duration:  15:30 min.

Summary: In this video, we move into assignments. Our exercises will cover scope, which is the lifetime of an object. Java Supports 4 basic variable scopes: Static variable, instance variable, local variable, and block variable. We will also talk about passing variables into methods, Arrays, and initialization blocks. Static initialization blocks run once, when the class is first loaded. Instance initialization blocks run every time a new instance is created. This video and the next will include discussions of garbage collection. Garbage collection is the way Java claims memory that is not reachable by the application.

Methodology of the development of example: Good coding standard and simplified design to prepare for the Java programmer certification exam CX-310-065.

Technology Used: Java - Core Concepts

Keywords: Sun Certified Java Programmer, Stack, Heap, Scope, Variable, Object, class, Assignment, Methods, reference, garbage collection, Array, initialization blocks, Boxing, Overloading.


Ayad Boudiab
Experience: A total of 10 years experience in developing applications using C++, Java, C#, ASP.NET, and SQL Server. In addition to 6 years experience in teaching programming courses at a local college. Degree: B.S. Computer Science Location: Atla...
1 comment has been posted.   Add your comment
[Fechar]

Este post é fechado - você precisa ter acesso ao post para incluir um comentário.

Matthew Casperson
The code for question 1 is:

class CardBoard {
Short story = 200;
CardBoard go(CardBoard cb) {
cb = null;
return cb;
}
public static void main(String[] args) {
CardBoard c1 = new cardBoard();
CardBoard c2 = new cardBoard();
CardBoard c3 = c1.go(c2);
c1 = null;
// do stuff
} }

When // do Stuff is reached, it is correct that 2 objects are eligible for GC, however it is not for the reasons described in the video. 

The CardBoard object that was pointed to by c1 is eligible for GC, because c1 is set to null.
The Short object referenced by the CardBoard object referenced by c1 is also eligible for GC, because it's parent object is now no longer accessible (because c1 was set to null). 

However, the variable c2 still points to an instance of the CardBoard class even after c1.go(c2) has returned. The video states that c2 will be set to null, which is incorrect. If you were to add the line of code 

System.out.println(c2.story.toString());

before // do stuff, "200" would be printed to the console. This can only be the case of c2 still points to a CardBoard object.

[+1 year ago]    Answer it
 
Help us to improve! Give us your feedback:

Give your note to this post: 1 2 3 4 5 6 7 8 9 10
Is this post helpful? Yes No



[Close]
To have full access to this post (or download the associated files) you must have MrBool Credits.

  See the prices for this post in Mr.Bool Credits System below:

Individually – in this case the price for this post is US$ 2,00 (Buy it now)
in this case you will buy only this video by paying the full price with no discount.

Package of 10 credits - in this case the price for this post is US$ 1,00
This subscription is ideal if you want to download few videos. In this plan you will receive a discount of 50% in each video. Subscribe for this package!

Package of 50 credits – in this case the price for this post is US$ 0,33
This subscription is ideal if you want to download several videos. In this plan you will receive a discount of 83% in each video. Subscribe for this package!


> More info about MrBool Credits








mrbool.com
contact us   |   publish your post   |   buy credits

Copyright 2013 - all rights reserved to www.web-03.net