Skip to main content

Posts

String,String Buffer and String Builder in Java

String:-  It is predefined Java class which provide immutable object means we can not change value of String from actual address. In Java We can write String using two different ways:- 1 String as a Object:-   String s = new String(); 2 String as a Reference:- String s = "hello"; Program Explanation of String:- public class StringExample {       public static void main(String[] args) {         String s1 = "hello";         String s = new String("hello");               String s2=s.concat("world");         String s3= s.toUpperCase();         System.out.println(s);         System.out.println(s1);         System.out.println(s2);         System.out.println(s3);     }   } Program Explanation of String with equals():- equals() is used to compare two ...

Function Overriding Concept in Java

Function Overriding:- We will create same name method from base class to derived class only functionality will be different. Overriding is used to extend the particular functionality of class ,without interfere to actual class. For example ExamSystem ,Old system is based on Number and now based on Grade  class Exam {       public void examInfo()      {         System.out.println("Main Exam");      }        public void examPattern()       {          System.out.println("Number System");      } } class Examnew extends Exam {   public void examPattern()       {          System.out.println("Grade System");      } public static void main(String[] args) {         Examnew obj = new Examnew();         obj.exam...

Abstract class in Java

Abstract class in Java:- Abstract class is flexible as compare to interface because we can define normal method and declare abstract method both.means it is combination of Interface Features and Class Features. We will use abstract modifier and public access specifier in abstract method abstract class Classname {      data member;      void fun()       {      }    abstract access specifier returntype functionname(); } Rules for abstract class:- 1 We can not create object of abstract class ,we should create reference of it . 2 abstract modifier should be used in Class-name and Method-name Advantage of Abstract class:- 1)  Security :-  we can not access abstract class directly hence if we want to hide details of actual class then we can create abstract. 2) data contract :-  all abstract method must be defined by child class . abstract class Area {     ...

Interface Concept in JAVA

Interface :- It is used to define set of rules which will be implemented by class,interface can contain complete description of particular component of an application. for example if we develop Area class then how many area's will be calculated that will be decided by interface. Syntax of Interface:- interface  Intefacename { } Rules for Interface:- 1) All methods of interface will be abstract and public by default.means interface only contain declaration of methods. 2) All methods of interface must be implemented into class.if we not implemented only single method then interface provide error 3) We should use implements keyword in interface to implement functionality in class .but in class we will use extends keyword. Interface Area {     void rectangle();     void circle(); } class AreaImpl implements Area {      public void rectangle()    {    }     public   void c...

Create Design in JSP Web pages using HTML and CSS:-

JSP means Java Server Pages .it provide designing of HTML Web pages. We can write all html tags and css under JSP web page. step for design:- 1) ADD JSP Web page 2 ) Create Layout  using <header></header>,<section></section> and <footer></footer> 3) Create CSS part and provide size of header,section and footer tag 4) Run JSP Web pages Complete Code of Designining   Under JSP :- <%--     Document   : design1     Created on : Sep 30, 2019, 7:14:36 PM     Author     : Shiva --%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE html> <html>     <head>         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">         <title>JSP Page</title>         <style type="text/css">         ...

User Define function in Python

User Define function in Python :- Function is used to subdivide the program code into different subroutine(partition).using function we can provide proper code structure to write python script. function provide understandably code pattern for programmer. Function also provide modular approach to develop real time project. Syntax of function:- def Functionname():   #Definition      statements      statements Functionname()   #Calling Type of Function:- 1 Default :- We can not pass any value from calling function to called function 1.1 With Return Type def fun():   statements;   return o/p 1.2 Without return type: def fun():    statements; 2 Parametrized:- we can pass value from calling function to called function 2.1 Required :- parameters is mandatory in required type arguments means if we take two arguments in function then both must be passed by calling function to called function...

Dictionary in Python

Dictionary in Python:- it is used to store data using key: value pair, the key is used to provide identity and value is used to represent data. Syntax var = {'key':value,'key':value,'key':value} student= {'rno':1001,'sname':"manish",'branch':"cs",'fees':45000} print(student['rno']) Dictionary provides a mutable object that means we can add, edit, and delete dictionary elements. 1) update():-  this method will add elements if the key does not exist otherwise update data. student.update({'key':value}) 2 delete():-  it is used to remove any data from the dictionary del(student['rno']) Complete Program Explanation of Dictionary:- student= {'rno':1001,'sname':"manish",'branch':"cs",'fees':45000} student.update({'sem':'vth'}) del(student['rno']) for key in student:     print(key + "-...