Java - TP

 
Vista:
sin imagen de perfil
Val: 5
Ha aumentado su posición en 6 puestos en Java (en relación al último mes)
Gráfica de Java

TP

Publicado por Cristian (1 intervención) el 20/10/2020 00:12:38
BUENAS TARDES, TENGO QUE RESOLVER UNOS EJERCICIOS, ME PODRIAN DAR UNA MANO?

1. Write a simple code to solve the following problem: Given a group of letters, print all existing acronyms. For example: {a,b,c} => abc; acb; bac; bca; cab; cba



2. When do you think it’s more appropriate to use JDBC instead of JPA?



3. Given the class “Parent” below, create a class “Child” that extends Parent, overrides method “calcularMultiplicacao” and overloads method “concatenarFrases”.

1
2
3
4
5
6
7
8
9
10
publicclass Parent {
 
public String concatenarFrases(String f1, String f2){
	return f1 + f2;
}
 
publicint calcularMultiplicacao(int fator1, int fator2){
	return fator1 * fator2;
}
}



4. Given the method below, explain:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
public List<Alunos> readAlunos() {
 
Repositorio alunoRepository = new Repositorio();
 
try {
	alunoRepository.setConnection(datasource.getConnection());
	List<Alunos> listaAlunos =alunoRepository.readListaAlunos();
	returnlistaAlunos;
} catch (Exception ex) {
	thrownew EJBException(ex);
} catch (SQLException ex) {
	thrownewDatabaseException(ex);
} finally {
	alunoRepository.close();
}
}


a. Why is the close()methodof class Repositorio being called inside finally?

b. The above code is wrong. What would you change in it to make it right? What other improvements could you suggestto make it even better?



5. What will be the result of execution of the code below:

1
2
3
4
5
6
7
8
9
10
11
public class TesteFujitsu() {
 
publicstaticvoidmain(String[] args) {
	int i = 2;
 
	if (i++ <= 3 && ++i > 4)
		i = 3;
 
	System.out.println(i);
}
}



6. Considering the following example of the a4j:support usage, answer the below question:

1
2
3
4
5
6
7
<h:outputLink value="#">
<a4j:supportreRender="component1, component2"
limitToList="true"event="onclick"
ajaxSingle="true
action="#{managedBean.method}">
</a4j:support>
</h:outputLink>


The a4j:support tag and its attributes are used to allow UI components to execute Ajax actions. Describe a real situation when you would use this tag and explain why.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
-1
Responder

IV

Publicado por ivan fernandez (3 intervenciones) el 20/10/2020 06:20:38
buenas
me ayudan aquí, estoy comenzando en el mundo de la programación y necesito ayuda

Se tiene un vector de números enteros para el cual se desea obtener el total de números pares e impares del arreglo, el promedio de los números que son múltiplos de 5, la suma de los números pares y el promedio de los impares
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
-1
Comentar