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 ?
LVL 20
Sathish David  Kumar NArchitectAsked:
Who is Participating?
 
objectsConnect With a Mentor Commented:
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
 
CEHJConnect With a Mentor Commented:
Try adding a default constructor:


public YourBean() {}


(should be there to comply with best practice)
0
 
Sathish David Kumar NArchitectAuthor 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
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

 
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 NArchitectAuthor Commented:
what abt private String name="";
0
 
objectsCommented:
yes thats fine, as long as you're initialising it to something
0
 
Sathish David Kumar NArchitectAuthor 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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.