Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Osoba {
- private int[] tab={1,2,5,1,3,4,3,7,6};
- public Osoba (){
- }
- public int oblicz (int a, int b){
- if(a>b)
- return a;
- else
- return b;
- }
- public void sort(){
- int pom;
- for(int j=0; j<tab.length; j++){
- for(int i = 0; i<tab.length-1; i++) {
- if (tab[i] > tab[i + 1]) {
- pom = tab[i];
- tab[i] = tab[i + 1];
- tab[i + 1] = pom;
- }
- }
- }
- }
- public void wypisz(){
- for(int i =0; i<tab.length; i++){
- System.out.print(tab[i]+" ");
- }
- }
- }
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////
- public class test {
- public static void main(String[] args) {
- Osoba o = new Osoba();
- System.out.println(o.oblicz(5,o.oblicz(10,15)));
- o.sort();
- o.wypisz();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement