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

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -