Given the following snippet A
private static final String SQL = "SELECT * FROM TABLE WHERE ID = ?";
and snippet B
public List<MyObject> getData(final Long id){
return (List<MyObject>)template.query("SELECT * FROM TABLE WHERE ID = ?",id);
}
and snippet C
public List<MyObject> getData(final Long id){
return (List<MyObject>)template.query(SQL,id);
}
Are B and C effectively the same? Does my string in B get gc'd (young generation?) because it has local scope?