Posts

Showing posts from November, 2020

ABSTRACTION

Data Abstraction is the property by virtue of which only the essential details are displayed to the user. abstraction is achieved by interfaces and abstract classes . Interfaces --- it does not have any defined methods so we can not make objects of interface. Classes implements interfaces   example -- public interface car { public boolean ispetrolcar(); public boolean enginetype(); } class automobile implements car{ ispetrolcar(){ return true} enginetype(){ return petrol;} }

Inheritance

where child class inherits parent class features with its own features . that we don't have to write code again and again Parent class ----  class   human being  Child class ---  class male extends human being

Object Oriented Programming

  Object Oriented Programming is used to implement real world  entities like inheritance, hiding, polymorphism etc in programming. Class :- it is a  definition  ---- mamals >human beings > male                                                                                        >female Object :- male guri=new male();

Arrays

A left rotation operation on an array shifts each of the array's elements 1 unit to the left. For example, if 2 left rotations are performed on array [1,2,3,4,5] , then the array would become [3,4,5,1,2] . Given an array a of n integers and a number, d , perform d left rotations on the array. Return the updated array to be printed as a single line of space-separated integers. CODE :- import java.io.*; import java.math.*; import java.security.*; import java.text.*; import java.util.*; import java.util.concurrent.*; import java.util.regex.*; public class Solution {     // Complete the rotLeft function below.     static int[] rotLeft(int[] a, int d)      {              int[] b= new int[a.length];         for(int i =0;i<d;i++){             b[a.length-d+i]=a[i];         }         for(int i =d;i<a.length;i++){     ...