DIGIT-ARC read-only archive · snapshot: July 23, 2026

help for the following statement

5 posts · originally from https://geek.digit.in/community/threads/help-for-the-following-statement.81890/

N
nitinm Original post #1
Mar 5, 2008 at 5:19 PM
can please any one tell me what is the meaning of the below statement

1) Account acc;

2) Account acc = new Savings Account;

can the second statement be applied for abstract classes
as i have heared abstract classes cannot be instantiated but we can create objects:confused: :confused: :confused:
ray|raven
Mar 5, 2008 at 5:23 PM
The first statement creates an object of the class Account.
The second one instantiates it;although i dont think the syntax is right.
Abstract classes can have objects created and not instantiated.
The second statement cant be used for abstract classes.
Pathik
Pathik #3
Mar 5, 2008 at 8:03 PM
^^ Exactly.
can please any one tell me what is the meaning of the below statement

1) Account acc;

2) Account acc = new Savings Account;

can the second statement be applied for abstract classes
as i have heared abstract classes cannot be instantiated but we can create objects:confused: :confused: :confused:

BTW Creating an object is the same as instantiating a class.
and yea the 2nd statement should be
Account acc= new Account;
If I am not missing anything.
redhat
redhat #4
Mar 5, 2008 at 8:27 PM
^^+1
Wrong Syntax in 2nd statement
It must be "Account acc= new Account;"
Zeeshan Quireshi
Mar 5, 2008 at 8:42 PM
Wrong ! :lol:

acc = new Account();

as acc has already been declared n we need to use the brackets to call the contructor :lol: