This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
This is my first time I contact JAVA, and now I learn about the class. My teacher told me that when we construct a object, it should follow six steps. Ex: A a = new A(); 1 2 6 34 5 But I still can't remember what the meaning of six steps. If someone can tell me how to memorize them. Thanks.
Andy -- Welcome to JavaRanch! We don't have too many rules 'round these parts, but we do have our naming policy, which requires you to have a non-fictitious-sounding display name -- you might try using your own first and last names, as many others here do. Please head over here and fix yours, pronto. Thanks pardner -- hope to see you around the Ranch! Now, as to your question: as someone who has taught Java programming for many years now, I can tell you with certainty that there are no universally recognized "six steps that constructing an object should follow." Maybe this was a particular teaching aid your professor used, in which case you might ask him or her, or ask a teaching assistant. It's their job to tell you, after all -- you're paying for an education! I'm sorry that we can't offer you any more regarding this issue, but please don't let that keep you from coming back when you have more questions. Usually we're pretty darn helpful! [ November 30, 2003: Message edited by: Ernest Friedman-Hill ]
Ernest, my guess is that the six steps refer to the breaking down of the actual statement. 1 = identifies the class of the variable holding the object 2 = identifies the name of the variable holding the object 3 = "new" creates a new object 4 = identifies the class of the object being created 5 = identifies the parameters being passed to the constructor 6 = assigns the newly created object to the variable
author and iconoclast
If so I can add: 7. add access rule (default, private, protected, public) 8. set default value of variables. 9. think about thread synchronization - add "synchronized" to some functions. 10. Think about can/should be class extends or no - add key word "abstract", or "final" 11. . . . . . . . There a lot of steps can be here. [ December 01, 2003: Message edited by: Igor Ko ]
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com