Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I am new to Java Programming.
I want to understand the basic difference between the code below
this.customerPage.selectcustomerrecent(Customer);
this.customerPage = this.customerPage.selectcustomerrecent(Customer);
this.customerPage.selectcustomerrecent(Customer);
This piece of code means that customerPage is an instance variable and it has a method named selectcustomerrecent which takes argument of Class type Customer
this.customerPage = this.customerPage.selectcustomerrecent(Customer);
This is same as above and the only difference is that the response value of method selectcustomerrecent is reassigned to the instance variable customerPage.
Related
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
What is the best way to implement a set interface in Java? Or more specifically, what is the best abstract data type to use when implementing a set interface? I need to create a set class in Java that implements a given set interface, but I'm wondering what the simplest way to do this is.
An interface example is java.util.Set, which is implemented by HashSet and TreeSet.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
Given the following method of a class which doesn't have type T defined:
public <T> T get(java.lang.String name) { /* compiled code */ }
Would it be possible to invoke this, and how?
Yes. Just call it with an explicit type argument:
foo.<Integer>get("something")
I'm not terribly fond of how type arguments are expressed in Java, but they're perfectly doable. See the Java Generics Tutorial for another example.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
If I have a variable defined in a method,can I get its Class Object using reflection
public void check(List<?> String> list){
Map<String,String> map // do something
}
Can i Obtain the Class Object to perform reflection for list and map variables,both are local variables
No, reflection does not expose local variables. Byte code analysis may help, but I don't know what you are trying to do.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
Is there a way to catch an exception if a certain "validate" method returns a false?
I am validating certain values given to the object and I want to throw an exception and print out an error message (but continue the program) when the valdation (which is called via the constructor) fails so that the object will not be created.
if (!validate())
throw new Exception();
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
E.g.
Car myCar = Car.Ford
instead of
Car myCar = new Car();
myCar = Car.Ford
I don't think there is a separate term. You appear to understand the terms assignment, and instantiation. You're just looking for non-instantation assignment at time of declaration?