Results 1 to 4 of 4

Thread: How to create object in JAVA

  1. #1
    Join Date
    Feb 2009
    Posts
    61

    How to create object in JAVA

    Hi,
    I need some information how to create object in a JAVA program. I am newbie in it. Also need some information on Java Expression. What does it means and how to use it. I had completed half of it. I had done with objects, Variables and Data Types and Java Operators. Now I had some project work to finish it up. So please post some appropriate suggestions. Thanks in advance.

  2. #2
    Join Date
    Oct 2005
    Posts
    2,393

    Re: How to create object in JAVA

    A expressions is a element that do the work of a Java program. Among other things, expressions are used to calculate and assign values to variables and to control the flow of a Java program. The work of an expression is divided into two parts, the calculations indicated by the elements of expression and return some value. It is actually a set of variables, operators, and method calls (constructed according to the syntax of language) that evaluates to a single value. The type of data returned by an expression depends on the elements used in the expression. The expression count + + returns an integer because + + returns the same type as its operand and count is an integer. Other expressions return boolean values, strings, etc ...

  3. #3
    Join Date
    May 2008
    Posts
    2,389

    Re: How to create object in JAVA

    An expression of a method call returns the value of the method and the data type of an expression of a method call is the same type of data that the method return value. The method System.in.read () was declared as an integer, hence the expression System.in.read () returns an integer. The second expression in the sentence System.in.read ()! = -1 Using the! =. Remember that this operator checks if the two operands are different. In this sentence the operands are System.in.read () and -1. As you can see, Java allows you to build compound expressions and statements from several small expressions provided that the data types required by a part of the expression matches the data types of the other. There will also be able to complete the above example, the order in which they evaluated the components of a compound expression.

  4. #4
    Join Date
    Feb 2008
    Posts
    1,852

    Re: How to create object in JAVA

    Here are some useful tips to generate a object in JAVA. First to you have to create Objects in Java. In Java, an object is created by creating an object of a class or, in other words, instantiating a class. Learn how to create a class later in Creating Classes. The new operator instantiates a class by allocating memory for the new object of that type. New needs a single argument: a call to the constructor. Constructor methods are special methods provided by each Java class that are causing these initialization of new objects of that type. The new operator creates the object, the constructor initializes.

Similar Threads

  1. get classes and object in java
    By preeti makkar in forum Software Development
    Replies: 1
    Last Post: 07-05-2012, 11:08 AM
  2. How to create an Object in Arrays?
    By sRIPRIYA in forum Software Development
    Replies: 4
    Last Post: 14-12-2010, 12:59 AM
  3. Adding an object in java
    By Gunner 1 in forum Software Development
    Replies: 5
    Last Post: 27-02-2010, 03:20 AM
  4. How big is an Object in Java? Why Java neglects sizeof?
    By KALINDA in forum Software Development
    Replies: 4
    Last Post: 10-11-2009, 03:19 AM
  5. Object test = new Object() <-- Java, best way in C++
    By ADISH in forum Software Development
    Replies: 3
    Last Post: 25-10-2008, 02:32 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,650,801.13325 seconds with 17 queries