Clase generica

/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package cod3; /** * * @author kirito */ public class CNumeros<T extends Number> { public CNumeros() { n1 = null; n2 = null; } public CNumeros(T n1, T n2) { this.n1 = n1; this.n2 = n2; } public T getN1() { return n1; } public T getN2() { return n2; } public T getRes() { return res; } public void setRes(T valor) { res = valor; } public void setN1(T valor) { n1 = valor; } public void setN2(T valor) { n2 = valor; } private T n1; private T n2; private T res; }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.