Wednesday 17 September 2014

Creating Object

Assume I have 2 classes one(Cse412lab2) contains the main method and the other (StackOfmethod) contains different other methods

Creating object of StackOfmethod class

StackOfmethod ob1=new StackOfmethod();

 Overloading Methods


public void method(){
        System.out.println("Nothing to print");
    }
 
    public void method(String name){
        System.out.println("Hello " +name);
     
    }

  Constructor

public StackOfmethod(String name, String Age){
        System.out.println("Hello "+name);
        System.out.println("Your Age " + Age );
             
}

*** class name StackOfmethod

 

Access private variable


    private int x=10;
    private int y=15;
    public void accessPrivateVariable(){
        int res=0;
     
        res =x+y;
        System.out.println(res);
    }

** variable out side any method are called instance variable

Netbeans Desktop application Example

Link of the Project

http://www.mediafire.com/?jw4qu2ml9ssfqgz

Basic GUI Java

Net-beans project code

http://www.mediafire.com/?uzg36zadm316ef2

Download Jdk and jre

http://www.oracle.com/technetwork/java/javase/downloads/index.html

Download Net-beans


http://netbeans.org/downloads/

Java networking

Java networking code for netbeans

http://www.mediafire.com/?dqpcxi6r100gir6

First run Host.java
then run Guest.java

Java Database Connection

Please find the following link of netbeans project for java database connection

http://www.mediafire.com/?a4sjp2paayk2bax

Please note that u have to create a database first using xampp with the name "cse412lab"
Then import the cse412lab.sql (available in the rar file) file while you are inside the database "cse412lab"

Now if you run the program using netbeans your program is likely to run without any error.

Ideone.com | Online Java Compiler & Debugging Tool 

Ideone.com | Online Java Compiler & Debugging Tool


OBJECT ORIENTED ANALYSIS & DESIGN

http://www.mediafire.com/?jr60x9rqyqtstaj
http://www.mediafire.com/?3mlc9c859wn72c9
http://www.mediafire.com/?yq0vmuf06dkwjw9
http://www.mediafire.com/view/?pafr9tc04a98qt0
http://www.mediafire.com/view/?bp47vxnrl8h4jqe
http://www.mediafire.com/?ajx1nlqk22i6tgb
http://www.mediafire.com/view/?mars072cgqped1z
http://www.mediafire.com/?7wn83uz29m1ikv3


Tomcat software:
http://www.mediafire.com/?l1sobjh13cm35zs

Java

Program

import java.lang.Math;
class b4
{
    public static void main (String[] args) {
        double a=56.34;
        double y=Math.sin(a);
        System.out.printf("The sin value of %f is %f",a,y);
}
}

 Output
The sin value of 56.340000 is -0.207157

 

Program

class it{
    public static void main (String[] args) {
        int i,j;
for(i=1;i<=5;i++)
{

for(j=1;j<=i;j++)
System.out.printf("% d\t",i);
System.out.printf("\n");
}      
}
}


Output

2 2 
3 3 3
4 4 4 4 
5 5 5 5 5 

Fibonaci

class fibonaci{
    public static void main (String[] args) {
int n,m=100,x,y;
n=0; x=1;
System.out.printf("%d\t",x);

while(x<=m)
{
y=n+x;
System.out.printf("% d\t",y);
n=x; x=y;
}
}
}

Output
1 1 2 3  5 8.........

Fahrenheit to Celsius

import java.util.Scanner;
class f
{
    public static void main (String[] args) {
        Scanner input = new Scanner(System.in);
        float  F;
        float  C;
        System.out.println("Enter a number");
        F = input.nextInt();
        C=(F-32)/18;
        System.out.printf("Converted Celsius Heat is %.2f",C);
}
}


Output
Enter a number
420
Converted Celsius Heat is 21.56

Program


import java.lang.Math;
class b1
{
    public static void main (String[] args) {
        double a=56.34;
        double y=Math.sqrt(a);
        System.out.printf("The Square Root of %f is %f",a,y);
}

Output 
The Square Root of 56.340000 is 7.505998

WELCOME NOTE

WELCOME NOTE


A KIND REQUEST TO MY FRIENDS AND FRIENDS OF MY FRIENDS


IF YOU LIKE THIS BLOG PLEASE REGISTER USING FOLLOWERS.IF YOU DONT LIKE THIS BLOG THEN GIVE US SUGGESTIONS TO MAKE THIS BLOG ATTRACTIVE.OR JUST GIVE US SOME COMMENTS.(ANY COMMENTS)IF YOU NEED SOMETHING JUST INFORM (EXCEPT MOVIES) ME.IF ANYONE WANT TO BECOME AN AUTHOR JUST MENTION YOUR NAME.


THANK YOU
YOUR'S FRIENDLY

OPERATING SYSTEMS (System Calls Imp)