Dim gr As Graphics
Dim bm = New Bitmap(System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width, _
System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height, _
System.Drawing.Imaging.PixelFormat.Format32bppArgb)
gr = Graphics.FromImage(bm)
gr.CopyFromScreen(System.Windows.Forms.Screen.PrimaryScreen.Bounds.X, _
System.Windows.Forms.Screen.PrimaryScreen.Bounds.Y, 0, 0, _
New Size(System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width, _
System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height))
Me.PictureBox1.Image = bm
public class Test{
private int data = 10;
public void setData(int data){
this.data = data;
}
public int getData(){
data = doSomthing();
return data;
}
private int doSomething(){
data = data * 5;
return data;
}
package Myclasses;
import java.util.Scanner;
//declare class
public class ComplexNo {
//declare variables.
private int a,b;
//functions should be public if needed to access from other class
public void getdata()
{
//print message to enter numbers
System.out.println("Enter a and b of a+ib:");
//Take input
Scanner input = new Scanner(System.in);
a = input.nextInt();
b = input.nextInt();
}
public ComplexNo addit(ComplexNo x)
{
ComplexNo tmp = new ComplexNo();
tmp.a = a+x.a;
tmp.b = b+x.b;
return tmp;
}
public void print()
{
System.out.println("The Sum of Complex Numbers = "+a+"+i"+b);
}
}
Create Main Class Code (Java)
import Myclasses.ComplexNo;
// the name of our class its public
public class ClassFunct {
//void main
public static void main (String[] args)
{
//declare class
ComplexNo no1 = new ComplexNo();
ComplexNo no2 = new ComplexNo();
ComplexNo sum = new ComplexNo();
//call functions
no1.getdata();
no2.getdata();
sum = no1.addit(no2);
sum.print();
}
}