Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners convert string type to mathod name
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


naveen
convert string type to mathod name
1 Answer(s)      2 years and 5 months ago
Posted in : Java Beginners


Please solve How to convert a string type data to as a method name? For Ex:

collTypeCatList = new ArrayList<CollTypeCategory>(); for(int i=1;i<=collTypeCatMasterList.size();i++){ //here i got a list size String str="custStatsMaster.getcusts"+i+"()"; //i have methods like custs1,cust2,.... CollTypeCategory collTypeCategory1 = new CollTypeCategory(); collTypeCategory1.setTitle("DISTRIBUTOR"); collTypeCategory1.setCustomers(str);//here i have to execute methods(but it takes like //string type) collTypeCatList.add(collTypeCategory1); }

Adv. Thanks....


Advertisement
View Answers

July 23, 2012 at 10:54 AM


Here is an example that stores the class object into arraylist and display them.

import java.util.*;

class Employee{
public int id;
public String name;
public String address;

public Employee(){}
public Employee(int id, String name,String address) {
this.id = id;
this.name = name;
this.address=address;

}
public int getId() {
return id;
}
public String getName() {
return name;
}
public String getAddress() {
return address;
}
}
public class Example{

public static void main(String[] args) throws Exception {
List<Employee> list = new ArrayList<Employee>();
list.add(new Employee(1, "A","Delhi"));
list.add(new Employee(2, "B","Mumbai"));
list.add(new Employee(3, "C","Chennai"));
list.add(new Employee(4, "D","Kolkata"));
System.out.println(" ");
for (Employee s : list){
System.out.println(s.getName()+" \t " +s.getAddress());
}
}
}


Related Tutorials/Questions & Answers:
convert string type to mathod name
convert string type to mathod name  Please solve How to convert a string type data to as a method name? For Ex: collTypeCatList = new ArrayList<..."); collTypeCategory1.setCustomers(str);//here i have to execute methods(but it takes like //string type
Convert an Integer type object to a String object
Convert an Integer type object to a String object   ... the Integer type object to a String object using the Integer.toBinaryString... into a string of binary type using the Integer.toBinaryString() and again to a hex
Advertisements
Convert a String into an Integer Data
the functionality to convert the string type data into an integer type data. Code... is used to convert an integer type data into a string type data. Here... Convert a String into an Integer Data  
Convert an Integer into a String
Convert an Integer into a String   ... type data into a string type. The java.lang package provides this conversion ... convert Integer number to string number. toString(): The toString() method
Convert Boolean to String
Convert Boolean to String       In this section, we are going to convert a Boolean type data... type data into a string. The toString() method reads the Boolean type object
Convert a String into an Integer Data
Convert a String into an Integer Data In this section you will learn to convert a string type of data to integer type data. Converting string to integer... these two type are widely used. By using Integer.parseInt(string to be convert
Convert String into long in java
Convert String into long in java In this section you will learn about conversion of numeric type String data into long in java. Converting string to long is similar to converting string to int in java, if you convert string to integer
Convert Character into a String
to convert a char into a string type data. The java.lang package provides the functionality to convert a character into a string.  Code Description... Convert Character into a String   
Convert String To Long
Convert String To Long        In this section, we are going to convert numeric type string...; to convert a string data (integer)  into a long type data.  Code Description
Convert String to a float
you to convert string type data into float and double by applying... Convert String to a Float       In this section, you will learn how to convert string data
Convert String To Float
Convert String To  Float    ... type string value into a float.  Code Description: This program takes a numeric type string at the console. The valueOf() method takes a string type
Convert String To Double
Convert String To Double       In this section, we are going to convert a numeric type string value...: This program simply takes a numeric type string at the console with the "Enter
Convert Date to String
Convert Date to String       In this section, you will learn to convert a date into string type. The java.util package provides the functionality to convert
HSSFCell to String type conversion
HSSFCell to String type conversion  Hello, Can anyone help me convert HSSFCell type to string. There is a solution in the following URL, but the method getWorkbook() is not defined for the class HSSFCell. Thanks in advance
Person have name field of Name type..??
Person have name field of Name type..??  Person have name field of Name type means i understood to create new Name class with fields firstname... name? can you please write code two two different class and show me how to use
convert string to date nsdate
convert string to date nsdate  Hi, How to convert c string to date NSDate?   Convert NSDate to NSString
How to convert into to String in Java?
How to convert into to String in Java?  Hi, How to convert into to String in Java? Thanks
How to convert a String to an int?
How to convert a String to an int?  I my program I am taking... format. Now I want to convert into int value. Tell me How to convert a String... contains the value 1025, then you can use the following code to convert the String
How to Convert String to Date?
How to Convert String to Date?  Hi, I am new in Java and learning... have to convert it to Date object. Tell me How to Convert String to Date? Thanks   Hi Dude, Its very easy to convert the String into date format
Conversion from short to String
to convert the myshort short type data to mystring String type data. Code...(buffreader.readLine()); // Convert short type data to String type String mystring...Conversion from short to String: In this tutorial we will learn how to convert
How to convert string to byte in Java
How to convert string to byte in Java  How to convert string to byte in Java
Convert Object To String
Convert Object To String       In this section, you will learn to convert an object to a string... in converting an object type data into a string type data. The toString() method
Convert String to long
Convert String to long       In this section, we will learn how to convert String to long. The following program provides you the functionality to convert String to long. Code
how to convert string to image in java
how to convert string to image in java  how to convert string to image in java? I know we need to convert image to a byte array at some point in my application but do not know how to convert a image into byte string. Please
Convert String to Date
Convert String to Date       In this example we are going to convert string into date We..., java.text.SimpleDateFormat and java.util.Date package to convert string into date format.We
data type used to store name.(getting an error)
data type used to store name.(getting an error)    Statement stm=con.createStatement(); String query="select * from employee where ename=\'"+ename+"\'"; ResultSet rs=stm.executeQuery(query
Convert String to Class - JSP-Servlet
Convert String to Class  Hi all, I am using Quartz as a scheduler.... Reading job name, class name, day & time using xml file only. Problem is while reading class name, retrieve as a string format but Quartz required in "Class" format
Conversion from int to String
Conversion from int to String: In this tutorial we will learn how to convert an int type value to a String type. You will convert an int value ... value from console and convert this int value to String type data. The line int
Convert Number to String
Convert Number to String       In this section, we will learn how to convert numbers to String. The following program provides you the functionality to convert numbers to String
Java convert string to InputStream
Java convert string to InputStream In this section, you will learn how to convert string to Inputstream. In one of the previous sections, we have discussed... of it. You can easily convert a string into an input stream. You can see
convert char to string objective c
convert char to string objective c  Converting char to string in objective c   NSString *s = [[NSString alloc] initWithBytes:arr + 2 length:3 encoding:NSUTF8StringEncoding
 

 

 

DMCA.com