• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 277
  • Last Modified:

what is mean by JAVA0137Non-abstract class missing constructor

what is mean by JAVA0137Non-abstract class missing constructor

actuly this message coming in my bean class . In bean class i have only only getter setter method ?

i check this \http://www.enerjy.com/explorer/help/rules/JAVA0137.html
what is the best practice ?
intilaize or create constructor

if i create constructor means what sholud be inside ?
0
Sathish David  Kumar N
Asked:
Sathish David  Kumar N
  • 6
  • 3
2 Solutions
 
objectsCommented:
its saying you are not initialising all your member vars

> if i create constructor means what sholud be inside ?

initialisation of all members vars
0
 
CEHJCommented:
Try adding a default constructor:


public YourBean() {}


(should be there to comply with best practice)
0
 
Sathish David Kumar NAuthor Commented:
>>>>>>if i create constructor means what sholud be inside ?
initialisation of all members vars

then what is diffrent between initialisation filed out side and inside the constructor .?

>>>>>>Try adding a default constructor:
public YourBean() {}

Normally JVM will provide default construtor right ?

0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
objectsCommented:
> then what is diffrent between initialisation filed out side and inside the constructor .?

none really. Are you initialising all your member vars?


> Normally JVM will provide default construtor right ?

only if you have not declared any other ctors
0
 
objectsCommented:
>> Normally JVM will provide default construtor right ?

> only if you have not declared any other ctors

So not really relevant here actually as you'll have a constructor either way.

0
 
objectsCommented:
should have:

private String name = null;

and not:

private String name;

If you have the latter then you need to initialise it in your constructor

public MyBean() {
   name = null;
}
0
 
Sathish David Kumar NAuthor Commented:
what abt private String name="";
0
 
objectsCommented:
yes thats fine, as long as you're initialising it to something
0
 
Sathish David Kumar NAuthor Commented:
is that should be final ? or noraml ?

private String name;       or private final String name;

0
 
objectsCommented:
depends if its value needs to change or not.
by the sound of it you need to be able to set it so you would not use final in that case.
final vars cannot be changed after they have been initialized
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 6
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now