TCS NQT Previous Year Solve | Day 3 | Slot 1 (IV) | Codewindow.in

Programming Logic

import java.util.*;
public class Main
{
    public static void main(String[] args)
    {
        ArrayListTempArrayList = new ArrayList();
        TempArrayList.add(30);
        TempArrayList.add(20);
        TempArrayList.add(10);
        TempArrayList.add(40);
        TempArrayList.add(50);
        Collections.sort(TempArrayList, Collections.reverseOrder());
        Collections.sort(TempArrayList, Collections.reverseOrder());
        System.out.println(TempArrayList);
    }
}
public class Main
{
    public static void main(String args[])
    {
        int x=10,y,z;
        z=y=x;
        y-= x --;
        z-=--x;
        x-= --x - x--;
        System.out.println(x+"-"+y+"-"+z);
    }
}
abstract class Shape{
    public abstract void Disp();
}
class Triangle extends Shape{
    public final void Disp(){
        System.out.println("It's Rectangle");
    }
}
public class Main{
    public static void main(String [] args){
        Rectangle obj = new Rectangle();
        obj.Disp();
    }
}

Also Checkout

Recent Posts

Leave a Comment

Your email address will not be published. Required fields are marked *