SlideShare a Scribd company logo
Web
                   Development
                   Practical File


Submitted By:                Submitted To:
Soumya Subhadarshi Behera    Mrs. Chavvi Rana
B.Tech- CSE (5th Semester)   Lect. CSE
1826
UIET, MD University
INDEX

Sr. No.   Date                    Topis              Signature and
                                                        Remarks
1.               Modulus Operator Description
2.               Relational and Logical Operators

3                Do while and For Loop description

4.               Parameterized Constructors

5.               String Methods

6.               Overloading Descriptions

7.               Inheritance

8.               Animal Interface

9.               Exception Handlers

10.              Writing inside a file
1. Modulus Operator Description
  class Remainder
  {
         public static void main (String args[])
         {
                 int i = 12;
                 int j = 4;
                 int k = 0;
                 System.out.println("i is " + i);
                 System.out.println("j is " + j);
                 k = i % j;
                 System.out.println("Its Remainder is " + k);
         }
  }




  class Divisor
  {
         public static void main(String[] args)
         {
         int a = 10;
         int b = 2;
         if ( a % b == 0 )
         {
                        System.out.println(a + " is divisible by "+ b);
         }
         else
         {
                        System.out.println(a + " is not divisible by " + b);
         }
         }
  }
2. Relational and Logical Operators
  class RelationalProgram
  {
          public static void main(String[] args)
          {                                      //a few numbers
                  int i = 3;
                  int j = 4;
                  int k = 4;
                  System.out.println("Greater than...");                   //greater than
                  System.out.println(" i > j = " + (i > j));       //false
                  System.out.println(" j > i = " + (j > i));       //true
                  System.out.println(" k > j = " + (k > j));       //false(equal) //greater than or equal to
                  System.out.println("Greater than or equal to...");
                  System.out.println(" i >= j = " + (i >= j)); //false
                  System.out.println(" j >= i = " + (j >= i)); //true
                  System.out.println(" k >= j = " + (k >= j)); //true
  //less than
                  System.out.println("Less than...");
                  System.out.println(" i < j = " + (i < j)); //true
                  System.out.println(" j < i = " + (j < i)); //false
                  System.out.println(" k < j = " + (k < j)); //false
  //less than or equal to
                  System.out.println("Less than or equal to...");
                  System.out.println(" i <= j = " + (i <= j)); //true
                  System.out.println(" j <= i = " + (j <= i)); //false
                  System.out.println(" k <= j = " + (k <= j)); //true
  //equal to
                  System.out.println("Equal to...");
                  System.out.println(" i is equivalent to j = " + (i == j));
                  System.out.println(" k is equivalent to j = " + (k == j));
  //not equal to
                  System.out.println("Not equal to...");
System.out.println(" i not equal to j = " + (i != j)); //true
               System.out.println(" k not equal to j = " + (k != j)); //false
       }
}




class ConditionalOperator
{
       public static void main(String[] args)
       {
               int x = 2;
               int y = 20, result=0;
               boolean bl = true;
               if((x == 5) && (x < y))
               {
                       System.out.println("value of x is "+ x);
               }
               if((x == y) || (y > 1))
               {
                       System.out.println("value of y is greater than the value of x");
               }
               result = bl ? x : y;
               System.out.println("The returned value is "+ result);
       }
}
3. Do while and For loop presentation
  class DoWhile
  {
         public static void main(String[] args)
         {
                 int count = 1;
                 do
                 {
                         System.out.println("Count is: " + count);
                         count++;
                 } while (count < 11);
         }
  }




  class ForLoop
  {
         public static void main(String[] args)
         {
for(int i = 1;i <= 10;i++)
                 {
                         for(int j = 1;j <= i;j++)
                         {
                                  System.out.print(i);
                         }
                         System.out.println();
                 }
         }
  }




4. Parameterized Constructor
  class Cube
  {
         int len;
         int bdth;
         int ht;
         public int getVolume()
         {
                  return (len * bdth * ht);
         }
         Cube()
         {
                  len = 15;
                  bdth = 15;
                  ht = 15;
         }
         Cube(int l, int b, int h)
         {
                  len = l;
                  bdth = b;
                  ht = h;
         }
public static void main(String[] args)
         {
                 Cube cubeObj1, cubeObj2;
                 cubeObj1 = new Cube();
                 cubeObj2 = new Cube(10, 20, 30);
                 System.out.println("Volume of Cube is : " + cubeObj1.getVolume());
                 System.out.println("Volume of Cube is : " + cubeObj2.getVolume());
         }
  }




5. String Methods
  import java.lang.*;

  class StrStartWith
  {
          public static void main(String[] args)
          {
                  System.out.println("String start with example!");
                  String str = "Welcome to my Coding!!!";
                  String start = "Welcome";
                  System.out.println("Given String : " + str);
                  System.out.println("Start with : " + start);
                  if (str.startsWith(start))
                  {
                           System.out.println("The given string is start with Welcome");
                  }
                  else
                  {
                           System.out.println("The given string is not start with Welcome");
                  }
          }
  }
import java.lang.*;
import java.io.*;
class StringLength
{
        public static void main(String[] args) throws IOException
        {
                System.out.println("String lenght example!");
                BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
                System.out.println("Please enter string:");
                String str = bf.readLine();
                int len = str.length();
                System.out.println("String lenght : " + len);
        }
}




import java.lang.*;

class StringTrim
{
        public static void main(String[] args)
{
                       System.out.println("String trim example!");
                       String str = " Hindustan";
                       System.out.println("Given String :" + str);
                       System.out.println("After trim :" +str.trim());
                 }
       }




6.Overloading Methods and Constructors
class OverloadDemo
{
        void test()
        {
               System.out.println("No parameters");
        }
// Overload test for one integer parameter.
        void test(int a)
        {
               System.out.println("a: " + a);
        }
// Overload test for two integer parameters.
        void test(int a, int b)
        {
               System.out.println("a and b: " + a + " " + b);
        }
// overload test for a double parameter
        double test(double a)
        {
               System.out.println("double a: " + a);
               return a*a;
        }
}

class Overload
{
        public static void main(String args[])
        {
                 OverloadDemo ob = new OverloadDemo();
                 double result;
// call all versions of test()
                 ob.test();
                 ob.test(11);
                 ob.test(11, 2);
                 result = ob.test(11.2);
                 System.out.println("Result of ob.test(11.2): " + result);
        }
}




7. Inheritance
class Base
{
        int a = 11;
        void show()
        {
                System.out.println(a);
        }
}
class Super extends Base
{
        int a = 22;
        void show()
        {
                super.show();
                System.out.println(a);
        }
        public static void main(String[] args)
        {
                new Super().show();
}
}




8.executing speak() and eat() methods using animal interface
interface IAnimal
{
        public void speak();
}
public class Cat implements IAnimal
{
        public void speak()
        {
                System.out.println("Cat speaks meaown!!!");
        }
        public static void main(String args[])
        {
                Cat c = new Cat();
                c.speak();
        }
}
public class Dog implements IAnimal
{
        public void speak()
        {
                System.out.println("Dog eats Cat!!!");
        }
        public static void main(String args[])
        {
                Dog d = new Dog();
                d.speak();
        }
}
9. Exception handling
import java.io.*;
import java.util.*;

class MyException extends Exception
{
       private String ssb="";
       public String getMessage(String s)
       {
               ssb=s;
               return ("you are not permitted to enter inside "+ ssb);
       }
}
class ExcepDemo
{
       public static void main(String args[]) throws MyException,IOException
       {
               String temp="";
               try
               {
                       String str="Soumya Subhadarshi Behera";
                       System.out.println("Enter your name");
                       BufferedReader br= new BufferedReader(new InputStreamReader(System.in));
                       temp=br.readLine();
                       if(!temp.equals(str))
                       throw new MyException();
                       else
                       System.out.println("Welcome to MDU");
               }
               catch(MyException e)
               {
                       System.err.println(e.getMessage(temp));
               }
catch(Exception e)
             {
                    System.err.println(e);
             }
      }
}




10.Writing inside a file
import java.lang.*;
import java.io.*;
class FileWrite
{
       public static void main(String args[])
       {
               try
               {
                      FileWriter fstream = new FileWriter("KeyboardInput.txt");
                      BufferedWriter out = new BufferedWriter(fstream);
                      BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
                      System.out.println("Please enter string:");
                      String str = bf.readLine();
                      out.write(str);
                      out.close();
               }
               catch (Exception e)
               {
               System.err.println("Error: " + e.getMessage());
               }
       }
}
Sam wd programs

More Related Content

What's hot

Java simple programs
Java simple programsJava simple programs
Java simple programsVEERA RAGAVAN
 
Why Learn Python?
Why Learn Python?Why Learn Python?
Why Learn Python?
Christine Cheung
 
soft-shake.ch - Java SE 7: The Fork/Join Framework and Project Coin
soft-shake.ch - Java SE 7: The Fork/Join Framework and Project Coinsoft-shake.ch - Java SE 7: The Fork/Join Framework and Project Coin
soft-shake.ch - Java SE 7: The Fork/Join Framework and Project Coin
soft-shake.ch
 
DCN Practical
DCN PracticalDCN Practical
DCN Practical
Niraj Bharambe
 
Core java pract_sem iii
Core java pract_sem iiiCore java pract_sem iii
Core java pract_sem iii
Niraj Bharambe
 
Basic java, java collection Framework and Date Time API
Basic java, java collection Framework and Date Time APIBasic java, java collection Framework and Date Time API
Basic java, java collection Framework and Date Time API
jagriti srivastava
 
Programming Java - Lection 07 - Puzzlers - Lavrentyev Fedor
Programming Java - Lection 07 - Puzzlers - Lavrentyev FedorProgramming Java - Lection 07 - Puzzlers - Lavrentyev Fedor
Programming Java - Lection 07 - Puzzlers - Lavrentyev Fedor
Fedor Lavrentyev
 
2012 JDays Bad Tests Good Tests
2012 JDays Bad Tests Good Tests2012 JDays Bad Tests Good Tests
2012 JDays Bad Tests Good Tests
Tomek Kaczanowski
 
Groovy 1.8の新機能について
Groovy 1.8の新機能についてGroovy 1.8の新機能について
Groovy 1.8の新機能について
Uehara Junji
 
Java practical
Java practicalJava practical
Java practical
william otto
 
Java.lang.object
Java.lang.objectJava.lang.object
Java.lang.object
Soham Sengupta
 
Apache Commons - Don\'t re-invent the wheel
Apache Commons - Don\'t re-invent the wheelApache Commons - Don\'t re-invent the wheel
Apache Commons - Don\'t re-invent the wheel
tcurdt
 
Java весна 2013 лекция 2
Java весна 2013 лекция 2Java весна 2013 лекция 2
Java весна 2013 лекция 2Technopark
 
Comparing JVM languages
Comparing JVM languagesComparing JVM languages
Comparing JVM languages
Jose Manuel Ortega Candel
 
About java
About javaAbout java
About javaJay Xu
 
Easy Going Groovy 2nd season on DevLOVE
Easy Going Groovy 2nd season on DevLOVEEasy Going Groovy 2nd season on DevLOVE
Easy Going Groovy 2nd season on DevLOVE
Uehara Junji
 
QA Auotmation Java programs,theory
QA Auotmation Java programs,theory QA Auotmation Java programs,theory
QA Auotmation Java programs,theory
archana singh
 
The Ring programming language version 1.6 book - Part 184 of 189
The Ring programming language version 1.6 book - Part 184 of 189The Ring programming language version 1.6 book - Part 184 of 189
The Ring programming language version 1.6 book - Part 184 of 189
Mahmoud Samir Fayed
 
Let's go Developer 2011 sendai Let's go Java Developer (Programming Language ...
Let's go Developer 2011 sendai Let's go Java Developer (Programming Language ...Let's go Developer 2011 sendai Let's go Java Developer (Programming Language ...
Let's go Developer 2011 sendai Let's go Java Developer (Programming Language ...
Uehara Junji
 

What's hot (20)

Java simple programs
Java simple programsJava simple programs
Java simple programs
 
Why Learn Python?
Why Learn Python?Why Learn Python?
Why Learn Python?
 
soft-shake.ch - Java SE 7: The Fork/Join Framework and Project Coin
soft-shake.ch - Java SE 7: The Fork/Join Framework and Project Coinsoft-shake.ch - Java SE 7: The Fork/Join Framework and Project Coin
soft-shake.ch - Java SE 7: The Fork/Join Framework and Project Coin
 
DCN Practical
DCN PracticalDCN Practical
DCN Practical
 
Core java pract_sem iii
Core java pract_sem iiiCore java pract_sem iii
Core java pract_sem iii
 
Basic java, java collection Framework and Date Time API
Basic java, java collection Framework and Date Time APIBasic java, java collection Framework and Date Time API
Basic java, java collection Framework and Date Time API
 
Programming Java - Lection 07 - Puzzlers - Lavrentyev Fedor
Programming Java - Lection 07 - Puzzlers - Lavrentyev FedorProgramming Java - Lection 07 - Puzzlers - Lavrentyev Fedor
Programming Java - Lection 07 - Puzzlers - Lavrentyev Fedor
 
2012 JDays Bad Tests Good Tests
2012 JDays Bad Tests Good Tests2012 JDays Bad Tests Good Tests
2012 JDays Bad Tests Good Tests
 
Groovy 1.8の新機能について
Groovy 1.8の新機能についてGroovy 1.8の新機能について
Groovy 1.8の新機能について
 
Java practical
Java practicalJava practical
Java practical
 
Java.lang.object
Java.lang.objectJava.lang.object
Java.lang.object
 
Apache Commons - Don\'t re-invent the wheel
Apache Commons - Don\'t re-invent the wheelApache Commons - Don\'t re-invent the wheel
Apache Commons - Don\'t re-invent the wheel
 
Java весна 2013 лекция 2
Java весна 2013 лекция 2Java весна 2013 лекция 2
Java весна 2013 лекция 2
 
Comparing JVM languages
Comparing JVM languagesComparing JVM languages
Comparing JVM languages
 
Unit Testing with Foq
Unit Testing with FoqUnit Testing with Foq
Unit Testing with Foq
 
About java
About javaAbout java
About java
 
Easy Going Groovy 2nd season on DevLOVE
Easy Going Groovy 2nd season on DevLOVEEasy Going Groovy 2nd season on DevLOVE
Easy Going Groovy 2nd season on DevLOVE
 
QA Auotmation Java programs,theory
QA Auotmation Java programs,theory QA Auotmation Java programs,theory
QA Auotmation Java programs,theory
 
The Ring programming language version 1.6 book - Part 184 of 189
The Ring programming language version 1.6 book - Part 184 of 189The Ring programming language version 1.6 book - Part 184 of 189
The Ring programming language version 1.6 book - Part 184 of 189
 
Let's go Developer 2011 sendai Let's go Java Developer (Programming Language ...
Let's go Developer 2011 sendai Let's go Java Developer (Programming Language ...Let's go Developer 2011 sendai Let's go Java Developer (Programming Language ...
Let's go Developer 2011 sendai Let's go Java Developer (Programming Language ...
 

Similar to Sam wd programs

Java file
Java fileJava file
Java file
simarsimmygrewal
 
Java programs
Java programsJava programs
Java Simple Programs
Java Simple ProgramsJava Simple Programs
Java Simple Programs
Upender Upr
 
java slip for bachelors of business administration.pdf
java slip for bachelors of business administration.pdfjava slip for bachelors of business administration.pdf
java slip for bachelors of business administration.pdf
kokah57440
 
Internet and Web Technology (CLASS-16) [Basic Elements of Java Program] | NIC...
Internet and Web Technology (CLASS-16) [Basic Elements of Java Program] | NIC...Internet and Web Technology (CLASS-16) [Basic Elements of Java Program] | NIC...
Internet and Web Technology (CLASS-16) [Basic Elements of Java Program] | NIC...
Ayes Chinmay
 
Java practice programs for beginners
Java practice programs for beginnersJava practice programs for beginners
Java practice programs for beginners
ishan0019
 
LECTURE 2 MORE TYPES, METHODS, CONDITIONALS.pdf
LECTURE 2 MORE TYPES, METHODS, CONDITIONALS.pdfLECTURE 2 MORE TYPES, METHODS, CONDITIONALS.pdf
LECTURE 2 MORE TYPES, METHODS, CONDITIONALS.pdf
ShashikantSathe3
 
Lab4
Lab4Lab4
Chapter i(introduction to java)
Chapter i(introduction to java)Chapter i(introduction to java)
Chapter i(introduction to java)
Chhom Karath
 
Understanding java streams
Understanding java streamsUnderstanding java streams
Understanding java streamsShahjahan Samoon
 
Chap2 class,objects contd
Chap2 class,objects contdChap2 class,objects contd
Chap2 class,objects contd
raksharao
 
OrderTest.javapublic class OrderTest {       Get an arra.pdf
OrderTest.javapublic class OrderTest {         Get an arra.pdfOrderTest.javapublic class OrderTest {         Get an arra.pdf
OrderTest.javapublic class OrderTest {       Get an arra.pdf
akkhan101
 
Java 8 Puzzlers [as presented at OSCON 2016]
Java 8 Puzzlers [as presented at  OSCON 2016]Java 8 Puzzlers [as presented at  OSCON 2016]
Java 8 Puzzlers [as presented at OSCON 2016]
Baruch Sadogursky
 
Presentation1 computer shaan
Presentation1 computer shaanPresentation1 computer shaan
Presentation1 computer shaan
walia Shaan
 
Java 8 lambda expressions
Java 8 lambda expressionsJava 8 lambda expressions
Java 8 lambda expressions
Logan Chien
 
JAVA.pdf
JAVA.pdfJAVA.pdf
JAVA.pdf
jyotir7777
 

Similar to Sam wd programs (20)

Java file
Java fileJava file
Java file
 
Java file
Java fileJava file
Java file
 
54240326 (1)
54240326 (1)54240326 (1)
54240326 (1)
 
54240326 copy
54240326   copy54240326   copy
54240326 copy
 
Java programs
Java programsJava programs
Java programs
 
Java Simple Programs
Java Simple ProgramsJava Simple Programs
Java Simple Programs
 
java slip for bachelors of business administration.pdf
java slip for bachelors of business administration.pdfjava slip for bachelors of business administration.pdf
java slip for bachelors of business administration.pdf
 
Internet and Web Technology (CLASS-16) [Basic Elements of Java Program] | NIC...
Internet and Web Technology (CLASS-16) [Basic Elements of Java Program] | NIC...Internet and Web Technology (CLASS-16) [Basic Elements of Java Program] | NIC...
Internet and Web Technology (CLASS-16) [Basic Elements of Java Program] | NIC...
 
Java practice programs for beginners
Java practice programs for beginnersJava practice programs for beginners
Java practice programs for beginners
 
LECTURE 2 MORE TYPES, METHODS, CONDITIONALS.pdf
LECTURE 2 MORE TYPES, METHODS, CONDITIONALS.pdfLECTURE 2 MORE TYPES, METHODS, CONDITIONALS.pdf
LECTURE 2 MORE TYPES, METHODS, CONDITIONALS.pdf
 
Lab4
Lab4Lab4
Lab4
 
Chapter i(introduction to java)
Chapter i(introduction to java)Chapter i(introduction to java)
Chapter i(introduction to java)
 
Understanding java streams
Understanding java streamsUnderstanding java streams
Understanding java streams
 
Chap2 class,objects contd
Chap2 class,objects contdChap2 class,objects contd
Chap2 class,objects contd
 
OrderTest.javapublic class OrderTest {       Get an arra.pdf
OrderTest.javapublic class OrderTest {         Get an arra.pdfOrderTest.javapublic class OrderTest {         Get an arra.pdf
OrderTest.javapublic class OrderTest {       Get an arra.pdf
 
Java 8 Puzzlers [as presented at OSCON 2016]
Java 8 Puzzlers [as presented at  OSCON 2016]Java 8 Puzzlers [as presented at  OSCON 2016]
Java 8 Puzzlers [as presented at OSCON 2016]
 
Presentation1 computer shaan
Presentation1 computer shaanPresentation1 computer shaan
Presentation1 computer shaan
 
Java 8 lambda expressions
Java 8 lambda expressionsJava 8 lambda expressions
Java 8 lambda expressions
 
JAVA.pdf
JAVA.pdfJAVA.pdf
JAVA.pdf
 
Oop lecture9 13
Oop lecture9 13Oop lecture9 13
Oop lecture9 13
 

More from Soumya Behera

Lead Designer Credential
Lead Designer CredentialLead Designer Credential
Lead Designer CredentialSoumya Behera
 
Appian Designer Credential Certificate
Appian Designer Credential CertificateAppian Designer Credential Certificate
Appian Designer Credential CertificateSoumya Behera
 
Credential for Soumya Behera1
Credential for Soumya Behera1Credential for Soumya Behera1
Credential for Soumya Behera1Soumya Behera
 
Visual programming lab
Visual programming labVisual programming lab
Visual programming labSoumya Behera
 
Dsd lab Practical File
Dsd lab Practical FileDsd lab Practical File
Dsd lab Practical File
Soumya Behera
 
C n practical file
C n practical fileC n practical file
C n practical file
Soumya Behera
 
School management system
School management systemSchool management system
School management systemSoumya Behera
 

More from Soumya Behera (11)

Lead Designer Credential
Lead Designer CredentialLead Designer Credential
Lead Designer Credential
 
Appian Designer Credential Certificate
Appian Designer Credential CertificateAppian Designer Credential Certificate
Appian Designer Credential Certificate
 
Credential for Soumya Behera1
Credential for Soumya Behera1Credential for Soumya Behera1
Credential for Soumya Behera1
 
Visual programming lab
Visual programming labVisual programming lab
Visual programming lab
 
Computer network
Computer networkComputer network
Computer network
 
Cn assignment
Cn assignmentCn assignment
Cn assignment
 
Matlab file
Matlab fileMatlab file
Matlab file
 
Dsd lab Practical File
Dsd lab Practical FileDsd lab Practical File
Dsd lab Practical File
 
C n practical file
C n practical fileC n practical file
C n practical file
 
School management system
School management systemSchool management system
School management system
 
Unix practical file
Unix practical fileUnix practical file
Unix practical file
 

Recently uploaded

Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
PedroFerreira53928
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
AzmatAli747758
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
Celine George
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
PedroFerreira53928
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
Celine George
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
Col Mukteshwar Prasad
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 

Recently uploaded (20)

Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 

Sam wd programs

  • 1. Web Development Practical File Submitted By: Submitted To: Soumya Subhadarshi Behera Mrs. Chavvi Rana B.Tech- CSE (5th Semester) Lect. CSE 1826 UIET, MD University
  • 2. INDEX Sr. No. Date Topis Signature and Remarks 1. Modulus Operator Description 2. Relational and Logical Operators 3 Do while and For Loop description 4. Parameterized Constructors 5. String Methods 6. Overloading Descriptions 7. Inheritance 8. Animal Interface 9. Exception Handlers 10. Writing inside a file
  • 3. 1. Modulus Operator Description class Remainder { public static void main (String args[]) { int i = 12; int j = 4; int k = 0; System.out.println("i is " + i); System.out.println("j is " + j); k = i % j; System.out.println("Its Remainder is " + k); } } class Divisor { public static void main(String[] args) { int a = 10; int b = 2; if ( a % b == 0 ) { System.out.println(a + " is divisible by "+ b); } else { System.out.println(a + " is not divisible by " + b); } } }
  • 4. 2. Relational and Logical Operators class RelationalProgram { public static void main(String[] args) { //a few numbers int i = 3; int j = 4; int k = 4; System.out.println("Greater than..."); //greater than System.out.println(" i > j = " + (i > j)); //false System.out.println(" j > i = " + (j > i)); //true System.out.println(" k > j = " + (k > j)); //false(equal) //greater than or equal to System.out.println("Greater than or equal to..."); System.out.println(" i >= j = " + (i >= j)); //false System.out.println(" j >= i = " + (j >= i)); //true System.out.println(" k >= j = " + (k >= j)); //true //less than System.out.println("Less than..."); System.out.println(" i < j = " + (i < j)); //true System.out.println(" j < i = " + (j < i)); //false System.out.println(" k < j = " + (k < j)); //false //less than or equal to System.out.println("Less than or equal to..."); System.out.println(" i <= j = " + (i <= j)); //true System.out.println(" j <= i = " + (j <= i)); //false System.out.println(" k <= j = " + (k <= j)); //true //equal to System.out.println("Equal to..."); System.out.println(" i is equivalent to j = " + (i == j)); System.out.println(" k is equivalent to j = " + (k == j)); //not equal to System.out.println("Not equal to...");
  • 5. System.out.println(" i not equal to j = " + (i != j)); //true System.out.println(" k not equal to j = " + (k != j)); //false } } class ConditionalOperator { public static void main(String[] args) { int x = 2; int y = 20, result=0; boolean bl = true; if((x == 5) && (x < y)) { System.out.println("value of x is "+ x); } if((x == y) || (y > 1)) { System.out.println("value of y is greater than the value of x"); } result = bl ? x : y; System.out.println("The returned value is "+ result); } }
  • 6. 3. Do while and For loop presentation class DoWhile { public static void main(String[] args) { int count = 1; do { System.out.println("Count is: " + count); count++; } while (count < 11); } } class ForLoop { public static void main(String[] args) {
  • 7. for(int i = 1;i <= 10;i++) { for(int j = 1;j <= i;j++) { System.out.print(i); } System.out.println(); } } } 4. Parameterized Constructor class Cube { int len; int bdth; int ht; public int getVolume() { return (len * bdth * ht); } Cube() { len = 15; bdth = 15; ht = 15; } Cube(int l, int b, int h) { len = l; bdth = b; ht = h; }
  • 8. public static void main(String[] args) { Cube cubeObj1, cubeObj2; cubeObj1 = new Cube(); cubeObj2 = new Cube(10, 20, 30); System.out.println("Volume of Cube is : " + cubeObj1.getVolume()); System.out.println("Volume of Cube is : " + cubeObj2.getVolume()); } } 5. String Methods import java.lang.*; class StrStartWith { public static void main(String[] args) { System.out.println("String start with example!"); String str = "Welcome to my Coding!!!"; String start = "Welcome"; System.out.println("Given String : " + str); System.out.println("Start with : " + start); if (str.startsWith(start)) { System.out.println("The given string is start with Welcome"); } else { System.out.println("The given string is not start with Welcome"); } } }
  • 9. import java.lang.*; import java.io.*; class StringLength { public static void main(String[] args) throws IOException { System.out.println("String lenght example!"); BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Please enter string:"); String str = bf.readLine(); int len = str.length(); System.out.println("String lenght : " + len); } } import java.lang.*; class StringTrim { public static void main(String[] args)
  • 10. { System.out.println("String trim example!"); String str = " Hindustan"; System.out.println("Given String :" + str); System.out.println("After trim :" +str.trim()); } } 6.Overloading Methods and Constructors class OverloadDemo { void test() { System.out.println("No parameters"); } // Overload test for one integer parameter. void test(int a) { System.out.println("a: " + a); } // Overload test for two integer parameters. void test(int a, int b) { System.out.println("a and b: " + a + " " + b); } // overload test for a double parameter double test(double a) { System.out.println("double a: " + a); return a*a; } } class Overload
  • 11. { public static void main(String args[]) { OverloadDemo ob = new OverloadDemo(); double result; // call all versions of test() ob.test(); ob.test(11); ob.test(11, 2); result = ob.test(11.2); System.out.println("Result of ob.test(11.2): " + result); } } 7. Inheritance class Base { int a = 11; void show() { System.out.println(a); } } class Super extends Base { int a = 22; void show() { super.show(); System.out.println(a); } public static void main(String[] args) { new Super().show();
  • 12. } } 8.executing speak() and eat() methods using animal interface interface IAnimal { public void speak(); } public class Cat implements IAnimal { public void speak() { System.out.println("Cat speaks meaown!!!"); } public static void main(String args[]) { Cat c = new Cat(); c.speak(); } } public class Dog implements IAnimal { public void speak() { System.out.println("Dog eats Cat!!!"); } public static void main(String args[]) { Dog d = new Dog(); d.speak(); } }
  • 13. 9. Exception handling import java.io.*; import java.util.*; class MyException extends Exception { private String ssb=""; public String getMessage(String s) { ssb=s; return ("you are not permitted to enter inside "+ ssb); } } class ExcepDemo { public static void main(String args[]) throws MyException,IOException { String temp=""; try { String str="Soumya Subhadarshi Behera"; System.out.println("Enter your name"); BufferedReader br= new BufferedReader(new InputStreamReader(System.in)); temp=br.readLine(); if(!temp.equals(str)) throw new MyException(); else System.out.println("Welcome to MDU"); } catch(MyException e) { System.err.println(e.getMessage(temp)); }
  • 14. catch(Exception e) { System.err.println(e); } } } 10.Writing inside a file import java.lang.*; import java.io.*; class FileWrite { public static void main(String args[]) { try { FileWriter fstream = new FileWriter("KeyboardInput.txt"); BufferedWriter out = new BufferedWriter(fstream); BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Please enter string:"); String str = bf.readLine(); out.write(str); out.close(); } catch (Exception e) { System.err.println("Error: " + e.getMessage()); } } }