Java Classes, Inheritance, DOM, JSP and Animation Practicals
Practical 1: Program on Class and Object in Java
Practical 1: Program on Class and Object in Java
class Student {
String name;
int rollNo;
Student(String name, int rollNo) {
this.name = name;
this.rollNo = rollNo;
}
static void displayInfo(Student student) {
System.out.println(“Student Name: ” + student.name);
System.out.println(“Roll Number: ” + student.rollNo);
}
}
class Main {
public static void main(String[] args) {
Student student1 = new Student(
Read MoreJava OOP, File Handling & JSP Practicals Guide Code Examples
<%
String name = request.getParameter(“userName”);
String bdate = request.getParameter(“birthDate”);
String email = request.getParameter(“emailAddr”);
int lucky = Integer.parseInt(request.getParameter(“luckyNo”));
%>
User Information Summary
Name: <%= name %>
BirthDate: <%= bdate %>
EMail: <%= email %>
Lucky Number: <%= lucky %>
Java and JavaScript Lab Experiments: Classes, Inheritance, JSP and DOM
Experiment 1: Classes, Objects, Looping, and Branching in Java
Aim: To write a Java program demonstrating classes, objects, looping, and branching statements.
Code:
class Calculator {
int add(int a, int b) {
return a + b;
}
}
public class Exp1 {
public static void main(String[] args) {
Calculator calc = new Calculator();
// Branching (if-else)
int num = 10;
if (num > 0) {
System.out.println(num + ” is positive.”);
} else {
System.
File Allocation Techniques in Operating System: Contiguous, Linked and Indexed
Explain Different File Allocation Techniques
(7 Marks Answer – Operating System)
Sabse pehle Hindi mein samjho 😊
File Allocation Techniques ka matlab hai hard disk mein files ko store karne ke liye disk blocks ko allocate karne ka tarika.
Operating System mein 3 main File Allocation Techniques hoti hain:
- Contiguous Allocation
- Linked Allocation
- Indexed Allocation
1. Contiguous Allocation
Definition: In this technique, ek file ke sabhi blocks disk mein continuously (ek ke baad ek) store hote hain.
Example:
Read MorePython Basics: Operators, Logic, Loops, Strings, Functions, Lists, Dictionaries and File I/O
Python Basics, Operators, Logic and Loops
Syntax and Reading Code
Variables such as x, y, value, word, text, n, i, total, and result are ordinary variable names, not Python commands. x=5 assigns or reassigns a value, while == compares equality. Python runs statements from top to bottom, expressions follow operator precedence, and chained methods run from left to right: s.lower().title().
#starts a comment that is ignored.- Indentation groups blocks of code.
:begins anif,for,while, ordefblock.()
Introduction to Java Programming: Basics, Comments, Loops and More
Introduction to Java Programming
Basics
– Every program has a file name, and that file name must match the name of the class.
– In order for a program to execute successfully, you need to have the following lines of code after the class header:
public class Review { ← class header
public static void main(String[] args) { ← main method header
//insert code here ← your code goes inside the body of the main method
}
}
Input-Process-Output
Every program will have inputs (variable declaration
Read More