Differentiate between primitives and objects, JAVA Programming

Assignment Help:

Differentiate between Primitives and Objects

  • Everything in Java is an "Object", as every class by default inherits from class

"Object", except a few primitive data types, which are there for efficiency reasons.

  • Primitive Data Types

Primitive Data types of java

boolean, byte                1 byte

char, short                   2 bytes

int, float                      4 bytes

long, double                 8 bytes

  • Primitive data types are normally used for local variables, parameters and instance variables (properties of an object)
  • Primitive datatype are located on stack and we can only access their value whereas objects are located on heap and we have a reference to these objects
  • Additionally primitive data types are always passed by value while objects are always passed by reference in java. There is no C++ like methods

- void someMethod (int &a, int & b) // not available in java

 


Related Discussions:- Differentiate between primitives and objects

Write down the class electricitysource, Question : (a) Explain the con...

Question : (a) Explain the concept of polymorphism when used in programs using suitable examples of your own. (b) (i) Distinguish between abstract methods and non-abstrac

Explain term literals in java, Explain term Literals in java? Literals ...

Explain term Literals in java? Literals are pieces of Java source code which mean exactly what they say. For example "Hello World!" is a String literal and its meaning is the w

Expertise in gps or navigation app coding, Project Description: Two co-f...

Project Description: Two co-founders are in search of a developer to join us to launch a tech startup. We have experience at fortune 500 companies, elite consulting firms, etc.,

What are application softwares, What are application softwares? List down t...

What are application softwares? List down the names of three application software's. Definition: Application Software are in which software then can interact directory along

Loosely coupled soa, Loosely coupled SOA SOA gives in loosely coupled ...

Loosely coupled SOA SOA gives in loosely coupled application elements, in which message is not necessarily tied to a particular database. Loose coupling actives enterprises to

Execution process of java bytecode, Execution Process of Java bytecode ...

Execution Process of Java bytecode JVM are available for almost every operating system. Java bytecode is executed by employing any operating system's JVM. Hence achieve port

Describe two reasons driving the termination of processes, Question 1: ...

Question 1: (a) Describe two reasons driving the termination of processes. (b) Discuss the five main steps the OS would implement once it has decided to create a new proc

What is includeaction, The IncludeAction class is useful when you require t...

The IncludeAction class is useful when you require to integrate Struts into an application that uses Servlets. Use the IncludeAction class to contain another resource in the respon

Javascript validation, 1. Obtaining the new script: Download and save the...

1. Obtaining the new script: Download and save the attached comment CGI mailer script form-mail2.pl to your server's cgi-bin directory, and change the permissions on the script t

Java and Arrays, AskWrite an application that uses an Array to store 10mess...

AskWrite an application that uses an Array to store 10messages of type String. You will store this Array with 10 messages of your choosing. For example, a message could be “I love

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd