Skip to main content

Posts

Nested Classes sample program

Nested Classes In Java, just like methods, variables of a class too can have another class as its member. Writing a class within another is allowed in Java. The class written within is called the nested class , and the class that holds the inner class is called the outer class . class Outer {  private class Inner  {    void dispaly()    {        System.out.println("this is inner class");       }   }  void call()  {    Inner obj=new Inner();    obj.dispaly();  } } class InnerDemo { public static void main(String s[]) {  Outer ob=new Outer();  ob.call(); } } Example solve watch video for understanding  // inner class By Prakash Sonar class outer {  private class Inner  {    void display()   {      System.out.println...

Steps to create user define exception in java

How to create user define exception in java ? Lets Create user defied exception in java . In this java tutorial i am using simple java code example where we accept number from user if number is one our program will throw user defied exception . You will find video tutorial also for this assignment on you tube . there are different types of exception in java mainly 1.User Defined   (user need to handle this exception) 2. System Defined ( it is defined by system itself/ Default  ) we are going to use following block in our program         try         {    //Program logic goes here  } catch           {    } finally           {     } Steps to create user define exception in java  create user define exception class which extends Exception define constructor for user defined exception class ...

how to create java package and use it

java creating simple package containing class and display method in another program accessing that package using import keyword video tutorial A   package  is a collection of related classes. it helps improve   re-usability. It helps   Organize  your classes into a folder structure and make it easy to locate and use them. Syntax used to create package is  package;   Step 1)   Consider the following code, ·        Save as demo.java ·        Compile using javac demo.java ·        Re comple ·        javac -d . demo.java ·        Packge name folder created ·         Java p1.c1 fully qulified name is used to run mehtod  package p1; class c1{ public void m1() { System.out.println("pakge class "); } ...

learn basic java from basic

Learn basic java from basic,learn basic java from basic, learn java from basic, understand java program from basic, pass string to java program, pass number to java program, java basic dynamic program, accept number and print using java program, accept name and display message java dynamic program, java type casting programming example  Hi friends in this blog post i am sharing with you java basics concepts this is day two tutorial . You must know installation and how to run java program in my previous post .  click here to know more  in assignment one we are going to print simple hello word message  in second program we are going to pass string parameter to java program and  in third assignment we are going to pass number parameter . to understand you must know the basic structure of java program   lets understand basic structure of java program  java program start with class name java class as shown in foll...

Basic java

java java java, learn java online free, classroom java tutorial, beginners java, java beginners, java programming,  basic java , basic java Tutorial,  basic java  Assignment           Hello friends ,       I am learning Basic java . my motive behind this blog is to help those want to learn Basic java online free of cost and grab each and every basic aspect of java programming .     you can find java tutorial from basic on this blog i will post each and every assignment of basic java with source code .          we will divide our course  in to Day work .          Let's start Day One  Basic Java Assignment for  Beginners      Basic Requirement to learn Java Programming Download following software             1. Text Editor (Notepad, Notepad++, Edit pad, Eclipse...

Labels

Show more