Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

java.lang.string

Status
Not open for further replies.

tamkash

Programmer
Nov 7, 2007
5
0
0
CA
Hi Guys, I am just wondering what kind of parameter I have to pass for java.lang.String? I am assuming that I can pass String value and in this program I am passing 'Happy Valentines Day'. Is it write way to pass the string value??
Code:
import java.util.*;

public class KeywordManager {
   
public static java.util.List identifyKeywords(java.lang.String searchTextBlock){
	  // 
	  	   
   }
  
   public static void main (String[] args){
	   
	   KeywordManager ks = new KeywordManager();
	   ks.identifyKeywords('Happy Valentines Day');
   }
}
 
Single quotes are for passing single characters, double quotes are used for passing string values.

To pass 'Happy Valentines Day' to your identifyKeywords method you should therefore not use ' but "

ks.identifyKeywords("Happy Valentines Day");
 
Since the method is defined static, you should call it in a static fashion:
Code:
List list = KeywordManager.identifyKeywords ("Happy Valentines Day");
You don't need an instance of KeywordManager to call the method.

don't visit my homepage:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top