i need to write a method that in my program student object for the student class that validates it's own data.
background on student class:
it's a program that ask for a name of a student and 3 test scores and print the highest , the lowest and the average.

i need to write a data validation method in which if the user enter a blank name(ex. " "), it prints an error message. if the data entered is valid (ex. "Austin"), it returns the value null.
i will really appreciate you help.

We're not going to write it for you so show us some effort and explain why you need help/ what exactly you need help with.

i need to write a data validation method in which if the user enter a blank name(ex. " "), it prints an error message. if the data entered is valid (ex. "Austin"), it returns the value null.

You just said the solution:
The method will have as argument a String.
If it is empty return a message (String)
else return null (a String can be null)
Use the trim and length method to do the checking.
Check the String API for these methods

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.