Computer Notes, Programming codes, Hardware and Networking Tip, Entertainment, Biography, Internet Tip, Tech News, Latest Technology, YouTube,

Latest Post
About RAM Advantages of multiprocessing system Associative memory Binary Number System CA CA Notes Change drive icon change pendrive icon Computer Abbreviation Computer Architecture Computer fundamental MCQ Computer Generation Computer generation computer notes Computer MCQ Computer Network MCQ Computer Operator MCQ Critical Section Critical section in OS Database connectivity in java Deadlock avoidance Deadlock detection algorithm Deadlock Detection and Recovery Deadlock detection method Deadlock Handling Deadlock in OS Deadlock Prevention Deadlock Recovery define object and class Define system cell Descrete Structure Device Driver Device driver in computer device driver in os DFA DFA contains with DFA ends with dfa examples dijkstra's algorithm Discrete Structure Discrete Structure graph theory Download JDBC Driver Download MySql Download PUBG DS DS Notes FCFS Job Scheduling Algorithm Finding shortest path Finite Sate Automata Flynn's Classifications fragmentation in computer fragmentation in harddisk fragmentation in os fragmented memory Full form related to computer Generations of operations Generations of OS Graph theory ICT 1st semester notes Instruction Address Modes Java java array declaration java class and object example Java Database connectivity example java event handling example program Java JDBC Java JMenuBar Java JSP program example java notes java program methods example Java program to create class and object java program to create methods java program to print even number between any two numbers Java programming java programming notes Java programs Java question answer java swing example java swing program to calculate simple interest Java Tutorials JSP program learn qbasic Lekh MCQ MCQ Computer MCQ Operating System memory fragmentation MICT 1st semester notes mict 1st semester operating system notes MICT first semester notes Multiprocessing mutex in os Necessary conditions for deadlock Number System Operating System Operating system notes OS OS Notes OS Numeric pattern printing program in qbasic patterns in qbasic Pipeline Hazards Pipelining Pipelining concept prime or composite in qbasic print patterns qbasic print series in qbasic Printing Series in qbasic PUBG PUBG Mobile PUBG PC PUBG Story qbasic qbasic code qbasic for class 10 qbasic for class 8 qbasic for class 9 qbasic for school QBASIC Pattern printing qbasic pattern printing program qbasic pattern printing programs qbasic pattern types qbasic patterns qbasic programming tutorials qbasic programs qbasic sequence printing programs qbasic tutorials Race Condition in Operating system reverse order in qbasic RISC and CISC RISC Pipeline Scheduling algorithm segmentation in operating system segmentation in os semaphore and mutex Semaphore concept in os Semaphore in os semaphore in os notes semaphore meaning sequential programs in qbasic series in qbasic series printing programs in qbasic shell in operating system shell in os shortest path shortest path algorithm simple interest program in java swing System Bus System Cell Teach Blog Tech Blog Tech School technical school The Shell in Operating system types of fragmentation Types of Multiprocessor types of operating system Types of pipeline hazards View Connected Wifi password Virtual Memory Virtual memory in OS Von Neumann's architecture What is associative memory? what is class? What is computer system? What is Fragmentation? What is jsp? what is object? What is process? What is segmentation What is System Cell What is Thread? what is virtual memory in computer What is virtual memory? पब्जी गेम

Pattern Type 
1
AA
222
bbbb
33333
cccccc


CLS
s$ = "1A2b3c"
FOR i = 1 TO LEN(s$)
    FOR j = 1 TO i
        PRINT MID$(s$, i, 1);
    NEXT j
    PRINT
NEXT i
END

Method 1: Using SUB END SUB
DECLARE SUB pattern(s$)
CLS
s$ = "1A2b3c"
CALL pattern(s$)
END


SUB pattern (s$)
    FOR i = 1 TO LEN(s$)
        FOR j = 1 TO i
            PRINT MID$(s$, i, 1);
        NEXT j
        PRINT
    NEXT i
END SUB

Method 1: Using FUNCTION END FUNCTION
DECLARE FUNCTION pattern$(s$)
CLS
r$ = pattern$(s$)
END


FUNCTION pattern$ (s$)
    s$ = "1A2b3c"
    FOR i = 1 TO LEN(s$)
        FOR j = 1 TO i
            PRINT MID$(s$, i, 1);
        NEXT j
        PRINT
    NEXT i
END FUNCTION

Click Here For More Patterns SET-1 in QBASIC Program

Click Here For More Patterns SET-2 in QBASIC Program




 

import java.util.Scanner; 
class Rectangle4{
	int l, b; 
	void getData(){
		Scanner in = new Scanner(System.in); 
		System.out.print("Enter length : "); 
		l=in.nextInt(); 

		System.out.print("Enter breadth : "); 
		b=in.nextInt(); 
	}

	void displayArea(){
		int a; 
		a = l*b; 
		System.out.println("Area = "+a); 
	}

	public static void main(String args[]){
		Rectangle4 obj = new Rectangle4();
		obj.getData(); 
		obj.displayArea();  
	}
}


Class is a blueprint to template of real world objects that specifies what data and what methods will be included in object of the class. Class is also called description group of object objects having similar properties. A class is also called user defined data type or programmers defined data type because we can define new data types according to our need by using classes.

Objects are instances of class. We can say that object is variable of class type. Memory for instance declaration rather at the time of class declaration rather than time of object creation. Thus we can say that objects have physical existence and classes are only concepts.


Declaring Classes
Syntax:
       [Access Modifier] className{
                 // body
       }

Creating Object
Syntax:
       [className] [objectName] = new [className]();

Program
 
class Demo{
 void display(){
  System.out.println("Class Example");
 }
 public static void main(String args[]){
  Demo obj = new Demo(); 
  obj.display(); 
 }
}


JSP is a Java Server side technology that does all the processing at server. It is used for creating dynamic web application using Java as programming language.

JSP Program to print "I Love Programming" 100 times.



Program
 
<!DOCTYPE html>
<html> 
<head> 
 <meta http-equiv="Content-Type" content="text/html" charset=UTF-8">
 <title> A simple JSP program </title> 
</head> 
<body> 
 <h1> Displaying "I love Programming 100 times !!" </h1> 
 <table> 
  <% for(int i=1; i<=100; i++){ %> 
   <tr> <td> I Love Programming </td> </tr> 
  <% } %>
 </table> 
</body> 
</html> 


Output of the given Java program

Program

 

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;       

class PTR extends JFrame implements ActionListener //implement listener interface
{
 JTextField t1, t2, t3, t4;
 JLabel l1,l2,l3, l4;
 JButton b1; 
 public PTR() 
 {
  super("Handling Action Event");
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);  
        l1 = new JLabel("Enter P :");
  l2 = new JLabel("Enter T :");
  l3 = new JLabel("Enter R : ");
  l4 = new JLabel("Interest : ");
  t1 = new JTextField(10);
  t2 = new JTextField(10);
  t3 = new JTextField(10);
  t4 = new JTextField(10); 
  b1 = new JButton("Calculate");
  
  setLayout(new FlowLayout(FlowLayout.LEFT,150,10));
        add(l1);
  add(t1);
  add(l2);
  add(t2);
  add(l3);
  add(t3);
  add(l4);
  add(t4); 
  add(b1);

  b1.addActionListener(this);//Registering event

  setSize(400,300);
        setVisible(true);
 }
 
 public void actionPerformed(ActionEvent ae) //Handle Event
 {
  int p, t, r, si; 
  p = Integer.parseInt(t1.getText());   
  t = Integer.parseInt(t2.getText()); 
  r = Integer.parseInt(t3.getText());
  if(ae.getSource() == b1)
   si = (p*t*r)/100;
  else
   si = 0; 

  t4.setText(String.valueOf(si));
 }

 public static void main(String a [])
 {
  new PTR();
 }
}


Array is a data structure which contains of similar data type. We store only fixed set of elements in a java array. Array is used to store a collection of data, but it is often more useful to think of an array as a collection of variable of the same type.

To declare an array in a Java program, we must declare a variable to reference the array and we most specify the type of array the variable can reference.
Syntax:
                 dataType[] arrayRefVar;
                      or
                 dataType arrayRefVar[];


Program
 

import java.util.Scanner; 
class EvenArray{
     public static void main(String args[]){
 Scanner in = new Scanner(System.in); 
 int x, y; 
 System.out.print("Enter First Number : "); 
 x = in.nextInt(); 
 System.out.print("Enter Second Number : "); 
 y = in.nextInt(); 

 for(int i=x; i<=y; i++){
      if(i%2==0){
     System.out.println(i); 
      }
 }
     }
}


MKRdezign

Contact Form

Name

Email *

Message *

Powered by Blogger.
Javascript DisablePlease Enable Javascript To See All Widget