ๅฐŠๆ•ฌ็š„ ๅพฎไฟกๆฑ‡็Ž‡๏ผš1ๅ†† โ‰ˆ 0.046215 ๅ…ƒ ๆ”ฏไป˜ๅฎๆฑ‡็Ž‡๏ผš1ๅ†† โ‰ˆ 0.046306ๅ…ƒ [้€€ๅ‡บ็™ปๅฝ•]
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 programs
VEERA 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 ะปะตะบั†ะธั 2
Technopark
ย 
Comparing JVM languages
Comparing JVM languagesComparing JVM languages
Comparing JVM languages
Jose Manuel Ortega Candel
ย 
Unit Testing with Foq
Unit Testing with FoqUnit Testing with Foq
Unit Testing with Foq
Phillip Trelford
ย 
About java
About javaAbout java
About java
Jay 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 file
Java fileJava file
Java file
simarsimmygrewal
ย 
54240326 (1)
54240326 (1)54240326 (1)
54240326 (1)
Vinayak Shedgeri
ย 
54240326 copy
54240326   copy54240326   copy
54240326 copy
Vinayak Shedgeri
ย 
Java programs
Java programsJava programs
Java programs
Dr.M.Karthika parthasarathy
ย 
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
Lab4
siragezeynu
ย 
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 streams
Shahjahan 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
ย 
Oop lecture9 13
Oop lecture9 13Oop lecture9 13
Oop lecture9 13
Shahriar Robbani
ย 

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 Credential
Soumya Behera
ย 
Appian Designer Credential Certificate
Appian Designer Credential CertificateAppian Designer Credential Certificate
Appian Designer Credential Certificate
Soumya Behera
ย 
Credential for Soumya Behera1
Credential for Soumya Behera1Credential for Soumya Behera1
Credential for Soumya Behera1
Soumya Behera
ย 
Visual programming lab
Visual programming labVisual programming lab
Visual programming lab
Soumya Behera
ย 
Computer network
Computer networkComputer network
Computer network
Soumya Behera
ย 
Cn assignment
Cn assignmentCn assignment
Cn assignment
Soumya Behera
ย 
Matlab file
Matlab fileMatlab file
Matlab file
Soumya 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 system
Soumya Behera
ย 
Unix practical file
Unix practical fileUnix practical file
Unix practical file
Soumya 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

The basics of sentences session 8pptx.pptx
The basics of sentences session 8pptx.pptxThe basics of sentences session 8pptx.pptx
The basics of sentences session 8pptx.pptx
heathfieldcps1
ย 
220711130082 Srabanti Bag Internet Resources For Natural Science
220711130082 Srabanti Bag Internet Resources For Natural Science220711130082 Srabanti Bag Internet Resources For Natural Science
220711130082 Srabanti Bag Internet Resources For Natural Science
Kalna College
ย 
Data Structure using C by Dr. K Adisesha .ppsx
Data Structure using C by Dr. K Adisesha .ppsxData Structure using C by Dr. K Adisesha .ppsx
Data Structure using C by Dr. K Adisesha .ppsx
Prof. Dr. K. Adisesha
ย 
Erasmus + DISSEMINATION ACTIVITIES Croatia
Erasmus + DISSEMINATION ACTIVITIES CroatiaErasmus + DISSEMINATION ACTIVITIES Croatia
Erasmus + DISSEMINATION ACTIVITIES Croatia
whatchangedhowreflec
ย 
INTRODUCTION TO HOSPITALS & AND ITS ORGANIZATION
INTRODUCTION TO HOSPITALS & AND ITS ORGANIZATION INTRODUCTION TO HOSPITALS & AND ITS ORGANIZATION
INTRODUCTION TO HOSPITALS & AND ITS ORGANIZATION
ShwetaGawande8
ย 
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptxCapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
CapitolTechU
ย 
Educational Technology in the Health Sciences
Educational Technology in the Health SciencesEducational Technology in the Health Sciences
Educational Technology in the Health Sciences
Iris Thiele Isip-Tan
ย 
The Science of Learning: implications for modern teaching
The Science of Learning: implications for modern teachingThe Science of Learning: implications for modern teaching
The Science of Learning: implications for modern teaching
Derek Wenmoth
ย 
Opportunity scholarships and the schools that receive them
Opportunity scholarships and the schools that receive themOpportunity scholarships and the schools that receive them
Opportunity scholarships and the schools that receive them
EducationNC
ย 
Observational Learning
Observational Learning Observational Learning
Observational Learning
sanamushtaq922
ย 
skeleton System.pdf (skeleton system wow)
skeleton System.pdf (skeleton system wow)skeleton System.pdf (skeleton system wow)
skeleton System.pdf (skeleton system wow)
Mohammad Al-Dhahabi
ย 
Contiguity Of Various Message Forms - Rupam Chandra.pptx
Contiguity Of Various Message Forms - Rupam Chandra.pptxContiguity Of Various Message Forms - Rupam Chandra.pptx
Contiguity Of Various Message Forms - Rupam Chandra.pptx
Kalna College
ย 
How to Setup Default Value for a Field in Odoo 17
How to Setup Default Value for a Field in Odoo 17How to Setup Default Value for a Field in Odoo 17
How to Setup Default Value for a Field in Odoo 17
Celine George
ย 
Brand Guideline of Bashundhara A4 Paper - 2024
Brand Guideline of Bashundhara A4 Paper - 2024Brand Guideline of Bashundhara A4 Paper - 2024
Brand Guideline of Bashundhara A4 Paper - 2024
khabri85
ย 
A Quiz on Drug Abuse Awareness by Quizzito
A Quiz on Drug Abuse Awareness by QuizzitoA Quiz on Drug Abuse Awareness by Quizzito
A Quiz on Drug Abuse Awareness by Quizzito
Quizzito The Quiz Society of Gargi College
ย 
Creative Restart 2024: Mike Martin - Finding a way around โ€œnoโ€
Creative Restart 2024: Mike Martin - Finding a way around โ€œnoโ€Creative Restart 2024: Mike Martin - Finding a way around โ€œnoโ€
Creative Restart 2024: Mike Martin - Finding a way around โ€œnoโ€
Taste
ย 
bryophytes.pptx bsc botany honours second semester
bryophytes.pptx bsc botany honours  second semesterbryophytes.pptx bsc botany honours  second semester
bryophytes.pptx bsc botany honours second semester
Sarojini38
ย 
Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...
Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...
Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...
EduSkills OECD
ย 
CIS 4200-02 Group 1 Final Project Report (1).pdf
CIS 4200-02 Group 1 Final Project Report (1).pdfCIS 4200-02 Group 1 Final Project Report (1).pdf
CIS 4200-02 Group 1 Final Project Report (1).pdf
blueshagoo1
ย 
How to Download & Install Module From the Odoo App Store in Odoo 17
How to Download & Install Module From the Odoo App Store in Odoo 17How to Download & Install Module From the Odoo App Store in Odoo 17
How to Download & Install Module From the Odoo App Store in Odoo 17
Celine George
ย 

Recently uploaded (20)

The basics of sentences session 8pptx.pptx
The basics of sentences session 8pptx.pptxThe basics of sentences session 8pptx.pptx
The basics of sentences session 8pptx.pptx
ย 
220711130082 Srabanti Bag Internet Resources For Natural Science
220711130082 Srabanti Bag Internet Resources For Natural Science220711130082 Srabanti Bag Internet Resources For Natural Science
220711130082 Srabanti Bag Internet Resources For Natural Science
ย 
Data Structure using C by Dr. K Adisesha .ppsx
Data Structure using C by Dr. K Adisesha .ppsxData Structure using C by Dr. K Adisesha .ppsx
Data Structure using C by Dr. K Adisesha .ppsx
ย 
Erasmus + DISSEMINATION ACTIVITIES Croatia
Erasmus + DISSEMINATION ACTIVITIES CroatiaErasmus + DISSEMINATION ACTIVITIES Croatia
Erasmus + DISSEMINATION ACTIVITIES Croatia
ย 
INTRODUCTION TO HOSPITALS & AND ITS ORGANIZATION
INTRODUCTION TO HOSPITALS & AND ITS ORGANIZATION INTRODUCTION TO HOSPITALS & AND ITS ORGANIZATION
INTRODUCTION TO HOSPITALS & AND ITS ORGANIZATION
ย 
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptxCapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
ย 
Educational Technology in the Health Sciences
Educational Technology in the Health SciencesEducational Technology in the Health Sciences
Educational Technology in the Health Sciences
ย 
The Science of Learning: implications for modern teaching
The Science of Learning: implications for modern teachingThe Science of Learning: implications for modern teaching
The Science of Learning: implications for modern teaching
ย 
Opportunity scholarships and the schools that receive them
Opportunity scholarships and the schools that receive themOpportunity scholarships and the schools that receive them
Opportunity scholarships and the schools that receive them
ย 
Observational Learning
Observational Learning Observational Learning
Observational Learning
ย 
skeleton System.pdf (skeleton system wow)
skeleton System.pdf (skeleton system wow)skeleton System.pdf (skeleton system wow)
skeleton System.pdf (skeleton system wow)
ย 
Contiguity Of Various Message Forms - Rupam Chandra.pptx
Contiguity Of Various Message Forms - Rupam Chandra.pptxContiguity Of Various Message Forms - Rupam Chandra.pptx
Contiguity Of Various Message Forms - Rupam Chandra.pptx
ย 
How to Setup Default Value for a Field in Odoo 17
How to Setup Default Value for a Field in Odoo 17How to Setup Default Value for a Field in Odoo 17
How to Setup Default Value for a Field in Odoo 17
ย 
Brand Guideline of Bashundhara A4 Paper - 2024
Brand Guideline of Bashundhara A4 Paper - 2024Brand Guideline of Bashundhara A4 Paper - 2024
Brand Guideline of Bashundhara A4 Paper - 2024
ย 
A Quiz on Drug Abuse Awareness by Quizzito
A Quiz on Drug Abuse Awareness by QuizzitoA Quiz on Drug Abuse Awareness by Quizzito
A Quiz on Drug Abuse Awareness by Quizzito
ย 
Creative Restart 2024: Mike Martin - Finding a way around โ€œnoโ€
Creative Restart 2024: Mike Martin - Finding a way around โ€œnoโ€Creative Restart 2024: Mike Martin - Finding a way around โ€œnoโ€
Creative Restart 2024: Mike Martin - Finding a way around โ€œnoโ€
ย 
bryophytes.pptx bsc botany honours second semester
bryophytes.pptx bsc botany honours  second semesterbryophytes.pptx bsc botany honours  second semester
bryophytes.pptx bsc botany honours second semester
ย 
Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...
Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...
Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...
ย 
CIS 4200-02 Group 1 Final Project Report (1).pdf
CIS 4200-02 Group 1 Final Project Report (1).pdfCIS 4200-02 Group 1 Final Project Report (1).pdf
CIS 4200-02 Group 1 Final Project Report (1).pdf
ย 
How to Download & Install Module From the Odoo App Store in Odoo 17
How to Download & Install Module From the Odoo App Store in Odoo 17How to Download & Install Module From the Odoo App Store in Odoo 17
How to Download & Install Module From the Odoo App Store in Odoo 17
ย 

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()); } } }
  ็ฟป่ฏ‘๏ผš