java - checking the value of the string parameter -
i have query , have method in recieved string parameter named head shown below
private string abcd( string head) { // inside method } now calling abcd method can pass different string value head parameter inside abcd method let if(head ="sgh") have perform , if value of head someother value let s="gfew" have nothing.
please advsie how can check string head getting value sgh string.
try following:
if ("sgh".equalsignorecase(head)) { // } else if ("gfew".equalsignorecase(head)) { // other } else ... // , on if you're using java 7, though, can use switch statement string objects.
switch (head) { case "sgh" : { //do } case "gfew" : { // someting else } .. }
Comments
Post a Comment