Archive
Creating and using objects in Java
Module 2: Creating and using objects.
Objectives:
-
Declaring object references, instantiating objects, and intializing object reference variables.
-
Compare how object reference variables are stored in relation to primitive variables.
-
Use a class (the String class) included in the Java SDK.
-
Use the J2SE class library specification to learn about other classes in this API.
In the previous module we discussed about primitive data types and how to use them with variables. In this module we will be focussing about objects and object reference variables. We will learn how object reference variables are stored in memory with reference to local variables. We will also take a look into the String class, as well as the class library specification to know about the other classes that we have access to.
1. Declaring object references, instantiating objects, and intializing object reference variables:
In the previous module we were dealing with primitive data types. And when we declared a variable of a primitive datatype, we stored the primitive in the variable itself. But Java is object oriented language, so we really want to be dealing with objects. While dealing with objects you will also need a variable associated with it. But it works different with the objects. You dont store an object inside of a variable like you do with the primitives. What you do is, you store a reference to the object inside the variable.
Now a reference is like an address to a house. It allows you to find that object. So using that reference we can call up that object and ask it to do something. We can either access its attributes, or we can access its methods. Just like we can send a letter to a house as we have its address, we can access an object using its reference.
Example: Declaring object references:
Here we have the ShirtTest class that we used in the previous module to create a Shirt object and then access it. In the following sections we will take a detailed look at the creation of myShirt object refernce variable and the creation of the Shirt object and how these two are tied together and how the myShirt object reference variable is used to access the Shirt object.
Declaring object reference variables: Read more…
Author
-
Nothing is hard to learn. Just need to make time and have the right passion.
-
Everyone has a worthy skill. If you don't feel it, you haven't recognised it.
-
It's humane to forget what was learnt a while ago:) Only makes it easier to revise when you need to.
-
Practice doing things in your own stiff timelines. It will help a great deal to fit in others.
-
Execution of a plan is more important than the plan itself.
-
Have good spirit, it will put others to rest. Besides it won't help having anything else.
-
Well, Have fun! :)
Categories
- Ant (3)
- Ant Installation & Configuration (1)
- Ant Introduction (1)
- Why Ant? (1)
- Eclipse IDE (8)
- Good considerations (4)
- Groovy / Grails (1)
- Integration Technlogies (2)
- Java (25)
- Core Java (20)
- Sun Microsystems Educational Services Course (20)
- Java Installation & Configuration (1)
- Java Introduction (1)
- Java Terminologies (1)
- Java Videos & Technology Talks (1)
- Why Java? (1)
- Core Java (20)
- Miscellaneous (1)
- MySQL (5)
- Simple Solutions (1)
- EditPlus (1)
- Source Control Management (1)
- Spring Framework (10)
- Tomcat (3)
Statistics
- 244,384 hits
Technical References
- Apache
- Cnet's Builder.com Cnet’s Builder.com website – All tech articles, some Java-centric.
- Codango Insight into JSP
- Developer.com Java articles hosted by Gamelan.com
- DevX Java articles hosted at DevX
- Eclipse Eclipse main site.
- Hibernate
- IBM's Developerworks IBM’s Developerworks; the Java section.
- JarHoo which class in which jar?
- Java About.com Java news and articles from About.com
- Java Almanac The online counterpart of the Java Developer’s Almanac – highly recommended for quick code snippets.
- Java Beat Interview Questions and Tutorials
- Java beginners Java beginners
- Java Blogs Blog aggregator for the most active Java-based blogs throughout the internet.
- Java DB code examples on java
- Java Desktop The desktop Java community hosted at Java.net.
- Java Developers Journal The Java Developers Journal online magazine website.
- Java Ibiblio The comp.lang.java FAQ – questions asked, answered, and categorized from the comp.lang.java newsgroup.
- Java Lectures lectures on java
- Java Links Links to various Java sites.
- Java Newsletters The Java Specialist Newsletter.
- Java Pro News java articles for java professionals
- Java Resources collection of resources on Java
- Java Server Faces
- Java tips and tricks Java Tips and Tricks
- Java tools and ideas A personal collection of tools and ideas.
- Java World One of the originals. Weekly updates of Java articles.
- Java.net The Java community website hosted by Sun Microsystems.
- Java2s Java examples (example source code) Organized by topic.
- Javacoffeebreak Insight into java technology
- Javalobby The heart of the Java developer community.
- JavaPro online magazine The JavaPro online magazine website.
- Javaskyline Dedicated to Java.
- Javaworld Solutions for java developers
- Jdbc-tutorial Tutorials on JDBC
- Jdocs Ajax driven multi-API java documentation repository
- jguru A great source for Q&A style interaction in the community.
- Mindprod Roedy Green’s Java Glossary
- O'Reilly's Java website New articles weekly.
- Open source java best open source java projects site
- Rose India Tutorials on java and related technologies
- Server-side discussion Often considered the resource for all discussion server-side Java specific.
- Simpler J2ee J2EE made simpler
- Spring Source
- Sun
- Sun Tutorials The Official Java tutorial from Sun – very useful for almost any feature set.
- Techonvideo videos on Java and related technologies.
- Web Developer's Journal
Websites
Recent Posts
- Subversion, Apache Server, Subclipse installation & configuration
- Learn To Build Beautiful HTML5 And CSS3 Websites In 1 Month
- Evolution of Open-Source Enterprise Service Bus (ESB)
- Good read for building high traffic website
- Another read on considerations for high traffic websites
- Build Twitter with Groovy Grails in 90 Minutes by Jeff Brown – Youtube
- Canonical Models
- Few of the best inspiring videos on “Power of One”
- SpringSource Tool Suite
- Spring Integration with Eclipse – SpringIDE
- Developing Spring Application in Eclipse IDE
- Things to know about Spring Download, Installation & Configuration
- Spring Download & Installation
- Why Spring Framework?
- Spring Framework Primer
- Exercise 2 – Using overloaded methods in Java
- Eclipse IDE Workbench, Editing, Ant, Help Tips & Tricks
- Spring Framework Introduction
- Spring Framework Terminologies
- Using operators and decision constructs in Java
Top Clicks
- None
Rajani Ramsagar
- Spring Integration with Eclipse – SpringIDE dlvr.it/QPCMCq 1 week ago
- Build Twitter with Groovy Grails in 90 Minutes by Jeff Brown –@Youtube wp.me/pCaqC-tU 4 years ago
- Another read on considerations for high traffic websites wp.me/pCaqC-tS 4 years ago
- Good read for building high traffic website dlvr.it/55mFZH 4 years ago
- One of the best inspiring videos on “Power of One” dlvr.it/50CrJV 4 years ago
Archives
- November 2014 (2)
- October 2014 (4)
- September 2014 (2)
- August 2014 (2)
- July 2014 (4)
- June 2014 (5)
- May 2014 (2)
- April 2014 (3)
- March 2014 (6)
- February 2014 (6)
- January 2014 (6)
- December 2013 (6)
- November 2013 (4)
- October 2013 (5)
- September 2013 (7)
For more..
- Visit DevelopersBook.COM for free tutorials ,articles, interview resources, technical forums.
- Visit CoreServlets.COM for customized J2EE Training Tutorials.
Pick your post
Latest Java Tools Additions
- License4J License ManagerProvides solutions for Java software product licensing. License4J includes libraries and GUI tools for generation and validation of license files, cryptographically secure serial numbers (product keys) and floating license files. A small pure Java runtime library provides a static method for license validation, and GUI tools allows generation of license file […]
- SuanShuJava numerical and statistics library of numerical methods and for numerical analysis and statistical data analysis. SuanShu provides a collection of data structures to represent many mathematical concepts to help you write good object-oriented code. Features include: - differentiation and integration - special functions - root finding - linear algebra - opt […]
Latest Java updates
- Log4EEclipse plugin that helps you to use your logger in Java projects. Log4E is not bound to any special logging framework, thus you might be able to adapt to your own logger by defining your own templates using the preferences. It has active support for Log4j, SLF4J, Commons Logging and JDK 1.4 logging. Categories: Tracing - Logging - Monitoringmore about Log4E […]
- Lingobit LocalizerLocalization solution for MFC, Delphi, .NET and Java based applications. Features include: - Support for multiple platforms: binary localization (Win32/MFC applications), Java Properties files, .NET Resource files and XML files. - Visual Localization: includes visual editors for dialogs. - Localizability Testing: Pseudo-Translate Expert can be used early dur […]
What’s new in Java tools?
- AutoMeterAutoMeter is an open source automation tool for scaling load tests using distributed slaves. Based on master-slave architecture where master acts as a test coordinator, from where tests are triggered and the actual tests are distributed across mu ...
- ServerspecWith Serverspec, you can write RSpec tests for checking your servers are configured correctly. Serverspec tests your servers actual state by executing command locally, via SSH, via WinRM, via Docker API and so on. So you dont need to install an ...
Bit Pipe
- AWS & Cloud Adoption in Australia/NZ: Highlights from AWS Summit Sydney 2018In this e-guide, read about the key highlights from this year's AWS Summit Sydney, including AWS's take on machine learning and what Australia needs to do to find its innovation mojo. Published by: ComputerWeekly.com
- Transforming Data Management with Autonomous WarehousingCan your data warehouse manage rapid data and user growth? Is it growing too complex to manage efficiently? These questions and more cross the minds of CIOs as they evaluate their data management strategies. Learn how you can modernize your data warehouse and keep pace with today's data demands. Published by: Oracle Cloud
Test, Test, JSF
- Setting JSF ProjectStage with JNDIOne nice feature of JSF2 is the ProjectStage setting. It lets the JSF implementation and the application developer optimize and customize behavior based on whether JSF is running in Development, Production, SystemTest, or UnitTest. The usual way to tell JSF about which ProjectStage to use is through a context param in web.xml. javax.faces.PROJECT_STAGE Dev […]
- Multi-JSF is here! Use any JSF in JBoss ASMulti-JSF is a JBoss AS feature that I've wanted to implement for a very, very long time. Basically, it allows you to use any JSF implementation as if it were the impl that ships with JBoss AS. This works with almost any version of MyFaces or Mojarra. You can even install multiple JSF implementations and tell each app which one to use.Until now, if y […]
MyEclipse::
- CodeMix – Technical Preview Now AvailableToday, we’ve shipped to the the Eclipse community our technical preview of CodeMix. What is CodeMix, how do you install it, what makes it so cool? Read on for the details.What is CodeMix?CodeMix is a technology that allows developers to take advantage of the wide array of tooling, language, and framework support that is available with […] The post CodeMix – […]
- MyEclipse 2018 – Where Art Thou?MyEclipse 2017 was first released in January 2017, and its most recent release, 2017 CI 10, was in December 2017. We will probably have a couple additional 2017 releases to round off that stream as well … so where’s MyEclipse 2018?The short answer – MyEclipse 2018 is coming in May, with one game-changing addition, CodeMix! […] The post MyEclipse 2018 – Where […]
JSF Resources
- JSF 2.0 JSR DraftDeprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/suresk/jsf-resources.com/wp-includes/functions-formatting.php on line 76 Ed Burns has posted a draft of the JSF 2.0 JSR. I won’t re-hash the feature list here, but I do have a few observations. First, I really like the features being proposed, and think they […]
- JSF Slider ComponentDeprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/suresk/jsf-resources.com/wp-includes/functions-formatting.php on line 76 Cagatay Civici has posted an example of how to quickly create a JSF slider component, built off of the scriptaculous slider widget. I like this for a few reasons: 1. It shows off an exc […]
Hibernate | JSF | Spring
- Book Excerpt | Good Relationships: The Spring Data Neo4j Guide BookThe Spring Data Neo4j Project This project is part of the Spring Data project, which brings the convenient programming model of the Spring Framework to modern NOSQL databases. Spring Data Neo4j, as the name alludes to, aims to provide support for the graph database Neo4j. The first part of the book provides a tutorial that walks through the creation of a com […]
- Spring: The Art of Using GRASP PatternsWhen we searched for design pattern articles, we found documentation concerning "Gang of Four" patterns. They are very useful and contribute to a well-designed application. But when I discovered GRASP principles , I advised any one interested to improve his skills design to look at these principles. It gives the fundamental rules of design. In this […]
JSFCentral — News
- An error has occurred; the feed is probably down. Try again later.
Spring Source
- This Week in Spring - Sept 24th 2013Hello everyone! Pieter posting this on Josh Long's behalf here... this week the Spring and Cloud Foundry teams are at JavaOne talking to developers about Spring, Cloud Foundry, Hadoop and big data! Happily, our pretty new @GoPivotal booth has garnered a lot of attention! I met Duke, too! I think the big guy was as happy to see me as I was him! Spring ni […]
- Webinar: Building Big Data Applications with Hadoop & SpringAt Pivotal we are bringing two open source projects together -- Hadoop and the very rapid and widely used Spring java application development framework to help build Big Data Applications. While Hadoop is proving to be the defacto foundation for storing and processing data, real-world scenarios require much more. Millions of developers are already using Spri […]
JSF 2.0 Group
- Early Draft Review 1: RecapJust in case you didn't notice, we released the Early Draft Review Draft (ERD) 1 of the JavaServer Faces 2.0 specification back in June. If you didn't have the time or inclination to read the spec, here are the key features it includes (links point to Ryan Lubke's well-written detailed blog entries): Feature Description Development stages Allo […]
- JSF 2 ScheduleSo, when is JSF 2 supposed to be released? The simple answer is "when Java EE 6 is released." But, for those who want a little more detail, here is the current schedule: MilestoneTarget DateHand Off to JCP DateCompletion Date Spec EDR1 21 Apr 2008 24 Apr 2008 3 Jun 2008 Spec EDR2 31 Aug 2008 Spec Public Review 26 Sept 2008 Spec Proposed Final […]
Hibernate Weblog
- Hibernate Community Newsletter 08/2018Welcome to the Hibernate community newsletter in which we share blog posts, forum, and StackOverflow questions that are especially relevant to our users. Articles A very good resource especially for beginners, this article shows you how JPA and Hibernate simplify data persistence. When using JPA and Hibernate, it is very important to log the statements that […]
- Hibernate OGM 5.4.0.Alpha1 is outWe’re happy to announce the release of Hibernate OGM 5.4.0.Alpha1. Hibernate OGM is now compatible with Hibernate ORM 5.3 (still a candidate release) and JPA 2.2. We support Infinipan 9.2 and JBoss modules are now available as WildFly feature packs. You can run server-side JavaScript on MongoDB or Java code in Infinispan Embedded as if they were stored proce […]
JDJ
- Microservices: Choosing the Right Cloud Services | @CloudExpo @IBMCloud #Cloud #DevOpsWe all know that end users experience the internet primarily with mobile devices. From an app development perspective, we know that successfully responding to the needs of mobile customers depends on rapid DevOps – failing fast, in short, until the right solution evolves in your customers' relationship to your business. Whether you’re decomposing an SOA […]
- Automated Solutions by @DivvyCloud | @CloudExpo #DevOps #AI #Monitoring"DivvyCloud as a company set out to help customers automate solutions to the most common cloud problems," noted Jeremy Snyder, VP of Business Development at DivvyCloud, in this SYS-CON.tv interview at 20th Cloud Expo, held June 6-8, 2017, at the Javits Center in New York City, NY.read more
Recent Comments