File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes How to get null values when the method does not return aything? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to get null values when the method does not return aything?" Watch "How to get null values when the method does not return aything?" New topic
Author

How to get null values when the method does not return aything?

Ziya Bakan
Greenhorn

Joined: Feb 07, 2013
Posts: 13
Hi all!!

i have a 2 classes class(in Java) First and class Second. There is e method in classSecond

public void update(String reading,String writing) {

ArrayList1.add(reading); System.out.println("reading: "+reading);

ArrayList2.add(writing); System.out.println("writing: "+writing);

}

And this update() method is called from class First like the following ;

object_ofClassSecond.update(reading,writing);

and classFirst obtains these reading, writing parameters from a third class(lets call it class Third) like the following:

String reading=request.getParameter("reading"); String writing=request.getParameter("writing");

There are some other things but i dont want to go into details.So the problem is whenever there is a reading or writing i get them from classThird and then pass them from classFirst to classSecond via the update() method.However sometimes this getParameter() method does not return anything and i need to assign the null values to my reading and writing variables in these kind of situations.I want to see the null values in the ArrayList1-2 in class Second whenever getParameter() method does not return anything.Could you please help me to do this? Thanks a lot in advance!!!
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3169
    
  10
So what's the problem ? If reading and writing are set to null by request.getParameter then this will be returned to the code that adds them to the array just the same as if they actually referred to a String object.


Joanne
 
 
subject: How to get null values when the method does not return aything?
 
Similar Threads
Trying to understand Static methods/objects
reading parameter from the request object in ActionServlet
Polynomial LinkedList from Text File (Modification)
JSTL Syntax
Reading a large text file ,modifying it and writing it to another file