OOP-JAVA Practical 7

OOP-JAVA Practical 7
  • Aim: Assume a vehicle plate number consists of three uppercase letters followed by four digits. Write a Program to generate a plate number.
  • Code:
    import java.util.*;
    public class practical7{
        public static void main(String args[]){
            Random r=new Random();
            int i;
            System.out.print("Vehical plate number is ");
            for(i=0;i<7;i++){
                if(i<3){
                    System.out.print((char)(r.nextInt(26)+65));
                }
                else{
                    System.out.print(r.nextInt(10));
                }
            }
        }
    }
  • Output:
    Output of practical 7

Comments