Translate
Thursday, 30 November 2017
Wednesday, 22 November 2017
font in css
<!DOCTYPE html>
<html>
<head>
<title>List Style</title>
<style>
.ul1 {
list-style-type: circle;
}
.ul2 {
list-style-type: square;
}
.ol1 {
list-style-type: upper-roman;
}
.ol2 {
list-style-type: lower-alpha;
}
</style>
</head>
<body>
<p>Example of unordered lists:</p>
<ul class="ul1">
<li>Coffee</li>
<li>Tea</li>
<li>Coca Cola</li>
</ul>
<ul class="ul2">
<li>Coffee</li>
<li>Tea</li>
<li>Coca Cola</li>
</ul>
<p>Example of ordered lists:</p>
<ol class="ol1">
<li>Coffee</li>
<li>Tea</li>
<li>Coca Cola</li>
</ol>
<ol class="ol2">
<li>Coffee</li>
<li>Tea</li>
<li>Coca Cola</li>
</ol> <ol class="ol2">
<li>Coffee</li>
<li>Tea</li>
<li>Coca Cola</li>
</ol>
</body>
</html>
List Style css
<!DOCTYPE html>
<html>
<head>
<title>List Style</title>
<style>
.ul1 {
list-style-type: circle;
}
.ul2 {
list-style-type: square;
}
.ol1 {
list-style-type: upper-roman;
}
.ol2 {
list-style-type: lower-alpha;
}
</style>
</head>
<body>
<p>Example of unordered lists:</p>
<ul class="ul1">
<li>Coffee</li>
<li>Tea</li>
<li>Coca Cola</li>
</ul>
<ul class="ul2">
<li>Coffee</li>
<li>Tea</li>
<li>Coca Cola</li>
</ul>
<p>Example of ordered lists:</p>
<ol class="ol1">
<li>Coffee</li>
<li>Tea</li>
<li>Coca Cola</li>
</ol>
<ol class="ol2">
<li>Coffee</li>
<li>Tea</li>
<li>Coca Cola</li>
</ol> <ol class="ol2">
<li>Coffee</li>
<li>Tea</li>
<li>Coca Cola</li>
</ol>
</body>
</html>
Saturday, 18 November 2017
text and background color css
<!DOCTYPE html>
<html>
<head>
<title>Background and text color</title>
<style>
.clr_cls {
background-color: red;
color: yellow;
}
</style>
</head>
<body>
<div class="clr_cls">
Mafasict
</div>
</body>
</html>
Friday, 17 November 2017
Java while loop example
While Loop Example
import java.util.Scanner;
class WhileLoop {
public static void main(String[] args) {
int n;
Scanner input = new Scanner(System.in);
System.out.println("Input an integer");
while ((n = input.nextInt()) != 0) {
System.out.println("You entered " + n);
System.out.println("Input an integer");
}
System.out.println("Out of loop");
}
}
Input an integer
7
You entered 7
Input an integer
-2
You entered -2
Input an integer
9546
You entered 9546
Input an inte
ger 0
Out of loop
Wednesday, 15 November 2017
Java 1st program
First Program
class Simple {
public static void main (string args []) {
System.out.println ("Hello Java");
}
}
save this file as Simple.java
To compile: javac Simple.java
To execute: java Simple
It will give output as Hello Java
Let's see what this is:
class keyword is used to declare a class in java.
Public keyword is an access modifier which represents visibility, it means it is visible to all.
static is a keyword, if we declare any method as static, it is known as static method. The main method is executed by the JVM, it does not require the object to invoke the main method. So it saves memory.
The void is the return type of method, it means it does not return any value.
main is a entry point of the program. Execution of programs starts from main. It is called by Runtime System
String [] args is used for command line argument. We will learn it later.
System.out.println () is used print statement.
Monday, 13 November 2017
Java switch statement
5.2 Switch statement
A switch statement is used instead of nested if...else statements. It is multiple branch decision statement.
A switch statement tests a variable with list of values for equivalence. Each value is called a case. The case value must be a constant i.
SYNTAX
switch(expression){
case constant:
//sequence of optional statements
break; //optional
case constant:
//sequence of optional statements
break; //optional
.
.
.
default : //optional
//sequence of optional statements
}
Individual case keyword and a semi-colon (:) is used for each constant.
Switch tool is used for skipping to particular case, after jumping to that case it will execute all statements from cases beneath that case this is called as ''Fall Through''.
In the example below, for example, if the value 2 is entered, then the program will print two one something else!
switch(i)
{
case 4: System.out.println(''four'');
break;
case 3: System.out.println(''three'');
break;
case 2: System.out.println(''two'');
case 1: System.out.println(''one'');
default: System.out.println(''something else!'');
}
To avoid fall through, the break statements are necessary to exit the switch.
If value 4 is entered, then in case 4 it will just print four and ends the switch.
The default label is non-compulsory, It is used for cases that are not present.
Sunday, 12 November 2017
java if statement
5.1 If statement
if statement
An if statement contains a Boolean expression and block of statements enclosed within braces.
if(conditional expression)
//statement or compound statement;
else
//optional
//statement or compound statement;
//optional
If the Boolean expression is true then statement block is executed otherwise (if false) program directly goes to next statement without executing Statement block.
if....else
If statement block with else statement is known as as if...else statement. Else portion is non-compulsory.
if ( condition_one )
{
//statements
}
else if ( condition_two )
{
//statements
}
else
{
//statements
}
If the condition is true, then compiler will execute the if block of statements, if false then else block of statements will be executed.
nested if...else
when a series of decisions are involved, we may have to use more than one if...else statement in nested form as follows:
if(test condition1)
{
if(test condition2)
{
//statement1;
}
else
{
//statement2;
}
}
else
{
//statement3;
}
//statement x;
Java program operator
4.1 Operators
Java provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following groups:
- Arithmetic Operators
- Relational Operators
- Bitwise Operators
- Logical Operators
- Assignment Operators
- Misc Operators
Arithmetic Operators:
Arithmetic operators are used in mathematical expressions in the same way that they are used in algebra.
arithmetic operators:
+ Additive operator (also used for String concatenation)
- Subtraction operator
* Multiplication operator
/ Division operator
% Remainder operator
Relational Operators:
There are following relational operators supported by Java language
> Greater than
< Less than
== Equal to
!= Not equal to
>= Greater than or equal to
<= Less than or equal to
Bitwise Operators:
Java defines several bitwise operators, which can be applied to the integer types, long, int, short, char, and byte.
Bitwise operator works on bits and performs bit-by-bit operation.
~ Unary bitwise complement
<< Signed left shift
>> Signed right shift
>>> Unsigned right shift & Bitwise AND
^ Bitwise exclusive OR
| Bitwise inclusive OR
Logical Operators:
The following table lists the logical operators:
&& Conditional-AND
|| Conditional-OR
?: Ternary (shorthand for if-then-else statement)
Assignment Operators:
There are following assignment operators supported by Java language:
= Simple assignment operator
+= Add AND assignment operator
-= Subtract AND assignment operator
*= Multiply AND assignment operator
/= Divide AND assignment operator
%= Modulus AND assignment operator
<<= Left shift AND assignment operator.
>>= Right shift AND assignment operator
&= Bitwise AND assignment operator.
^= bitwise exclusive OR and assignment operator.
|= bitwise inclusive OR and assignment operator.
Increment and Decrement Operators
Increment and decrement operators are used to add or subtract 1 from the current value of oprand.
++ increment
-- decrement
Increment and Decrement operators can be prefix or postfix.
In the prefix style the value of oprand is changed before the result of expression and in the postfix style the variable is modified after result.
For eg.
a = 9;
b = a++ + 5;
/* a=10 b=14 */
a = 9;
b = ++a + 5;
/* a=10 b=15 */
Miscellaneous Operators
There are few other operators supported by Java Language.
Conditional Operator ( ? : )
Conditional operator is also known as the ternary operator.
The operator is written as:
variable x = (expression) ? value if true : value if false
Instance of Operator:
This operator is used only for object reference variables.
instanceof oper
ator is wriiten as:
( Object reference variable ) instanceof (class/interface type)
Java data types
3.2 Data type
Every variable in Java has a data type. Data types specify the size and type of values that can be stored.
Data types in Java divided primarily in two tyeps:
Primitive(intrinsic) and Non-primitive.
Primitive types contains Integer, Floating points, Characters, Booleans And Non-primitive types contains Classes, Interface and Arrays.
Integer:This group includes byte, short, int and long, which are whole signed numbers.
Floating-point Numbers: This group includes float and double, which represent number with fraction precision.
Characters: This group includes char, which represents character set like letters and number
Boolean: This group includes Boolean, which is special type of representation of true or false value.
Some data types with their range and size:
byte: -128 to 127 (1 byte)
short: -32,768 to +32,767 (2 bytes)
int: -2,147,483,648 to +2,147,483,647 (4 bytes)
float: 3.4e-038 to 1.7e+0.38 (4 bytes)
double: 3.4e-038 to 1.7e+308 (8 bytes)
char : holds only a single character(2 bytes)
boolean : can take only
true or false (1 bytes)
Java program variables
3.1 Variables
A variable provides us with named storage that our programs can manipulate.
Each variable in Java has a specific type, which determines the size and layout of the variable's memory; the range of values that can be stored within that memory; and the set of operations that can be applied to the variable.
You must declare all variables before they can be used.
The basic form of a variable declaration is shown here:
data_type variable = value;
Here data type is one of Java's datatypes and variable is the name of the variable. To declare more than one variable of the specified type, you can use a comma-separated list.
Following are valid examples of variable declaration and initialization in Java:
int a, b, c;
// Declares three ints, a, b, and c.
int a = 10, b = 10;
// Example of initialization
double pi = 3.14159;
// declares and assigns a value of PI.
char a = 'a';
// the char variable a iis initialized with value 'a'
Constant: During the execution of program, value of variable may change. A constant represents permanent data that never changes.
If you want use some value likes p=3.14159; no need to type every time instead you can simply define constant for p, following is the syntax for declaring constant.
Static final datatype ConstantName = value;
Example: stat
ic final float PI=3.14159;
Java program features
1.2 Features
1. Simple
Java is easy to learn and its syntax is quite simple and easy to understand.
2. Object-Oriented
In java everything is Object which has some data and behaviour. Java can be easily extended as it is based on Object Model.
3. Platform independent
Unlike other programming languages such as C, C++ etc which are compiled into platform specific machines. Java is guaranteed to be write-once, run-anywhere language.
On compilation Java program is compiled into bytecode. This bytecode is platform independent and can be run on any machine, plus this bytecode format also provide security. Any machine with Java Runtime Environment can run Java Programs.
4. Secured
When it comes to security, Java is always the first choice. With java secure features it enable us to develop virus free, temper free system. Java program always runs in Java runtime environment with almost null interaction with system OS, hence it is more secure.
5. Robust
Java makes an effort to eliminate error prone codes by emphasizing mainly on compile time error checking and runtime checking. But the main areas which Java improved were Memory Management and mishandled Exceptions by introducing automatic Garbage Collector and Exception Handling.
6. Architecture neutral
Compiler generates bytecodes, which have nothing to do with a particular computer architecture, hence a Java program is easy to intrepret on any machine.
7. Portable
Java Bytecode can be carried to any platform. No implementation dependent features. Everything related to storage is predefined, example: size of primitive data types
8. High Performance
Java is an interpreted language, so it will never be as fast as a compiled language like C or C++. But, Java enables high performance with the use of just-in-time compiler.
9. Multithreaded
Java multithreading feature makes it possible to write program that can do many tasks simultaneously. Benefit of multithreading is that it utilizes same memory and other resources to execute multiple threads at the same time, like While typing, grammatical errors are checked along.
10. Distributed
We can create distributed applications in java. RMI and EJB are used for creating distributed applications. We may access files by calling the methods from any machine on the internet.
11. Interpreted
An interpreter is needed in order to run Java programs. The programs are compiled into Java Virtual Machine code called bytecode. The bytecode is machine independent and is able to run on any machine that has a Java interpreter. With Java, the program need only be compiled once, and the bytecode generated by the Java c
ompiler can run on any platform.
introduction Java
1.1 Introduction
Java is a simple and yet powerful object oriented programming language and it is in many respects similar to C++.
Java is created by James Gosling from Sun Microsystems (Sun) in 1991. The first publicly available version of Java (Java 1.0) was released in 1995.
Java is defined by a specification and consists of a programming language, a compiler, core libraries and a runtime machine(Java virtual machine).
The Java runtime allows software developers to write program code in other languages than the Java programming language which still runs on the Java virtual machine.
The Java platform is usually associated with the Java virtual machine and the Java core libraries.
Java virtual machine
The Java virtual machine (JVM) is a software implementation of a computer that executes programs like a real machine.
Java Runtime Environment vs. Java Development Kit
A Java distribution typically comes in two flavors, the Java Runtime Environment (JRE) and the Java Development Kit (JDK).
The JRE consists of the JVM and the Java class libraries. Those contain the necessary functionality to start Java programs.
The JDK additionally contains the development tools necessary to create Java programs. The JDK therefore consists of a Java compiler, the Java virtual machine and the Java class libraries.
Uses of JAVA
Java is also used as the programming language for many different software programs, games, and add-ons.
Some examples of the more widely used programs written in Java or that use Java include the Android apps, Big Data Technologies, Adobe Creative suite, Eclipse, Lotus Notes, Minecraft, OpenOffice, Runescape, and Vuze.
Friday, 10 November 2017
java basic
JAVA PROGRAM
Object oriented and cant write procedural programs
Functions are called methods
Unit of a program is the class from which objects are created
Automatic garbage collection
Singleinheritance only
Each class contains data and methods which are used to manipulate the data
Programs are small and portable
Multithreaded which allows several operations to be executed concurrently
A rich set of classes and methods are available in java class libraries
Platform Independent
Case sensitive
java program development
* Edit –use any editor
* Compile –use command ‘javac’ if your program compiles correctly, will create a file with extension .class
* Execute –use the command ‘java’
java language keyword
Keywords are special reserved words in java that you cannot use as identifiers for classes, methods or variables. They have meaning to the compiler, it uses them to understand what your source code is trying to do.
first Java program
class FirstPro {
public static void main(String args[])
{
System.out.println("Hello World!“);
}
}
java source files
All java source files must end with the extension ‘.java’
Generally contain at most one top level public class definition
If a public class is present, the class name should match the file name
top level elevents appears in a file
If these are present then they must appear in the following order.
Package declarations
Import statements
Class definitions
identifiers
An identifier is a word used by a programmer to name a variable, method class or label.
Keywords may not be used as an identifier
Must begin with a letter, a dollar sign($) or an underscore( _ ).
Subsequent character may be letters, digits, _ or $.
Cannot include white spaces.
declering
Sunday, 5 November 2017
ms access short question answer
MS ACCESS
1) What is Database Management System (DBMS)?
*computer Software to manage, maintain database as well as view update and retrieve data is called database management system.
2)What do you mean by data processing?
*The term data processing embraces the technique of sorting, relating, interpreting and computing items of data in order to provide meaningful and useful information.
3) List some database applications.
* Some of the popular database management systems are: Oracle, Sybase, MS Access, MS SQL Server, Paradox, DB/2, Dbase, FoxPro, MySql
4) What is MS-Access?
* MS-Access is a RDBMS (Relational Database Management System) application developed by Microsoft Inc. that runs on Windows operating System.
5) What is Database?
* A database is an organization of data related to a particular subject or purpose so that the data can be retrieved or processed.
6) What is the extension of Access database file?
*The extension of MS-Access data file is MDB.
7) What is relational database?
*A database with tables related to each other on a common field to facilitate the data retrieval from multiple tables is known as relational database.
8) What is a key field?
* A common field on which two tables are linked is known as key field.
9) What is primary key?
* A primary key is a rule which ensures that unique data is entered for the field and the field is not left blank. This is the field that would indentify a record uniquely in table
10) What do you mean by foreign key?
*The common field in child table that maintains relation with master table is foreign key.
11) What are the elements of a database?
*The major six elements of a database are Tables, Queries, Form, Reports, Macros, Modules
12) What is a table?
*A table is a collection of data about a specific topic such as products, students or suppliers. A table organizes data into columns (fields) and rows (records or tuples)
13) What is a field?
*A field in a database is a piece of information about a subject. Each field is arranged as a column in table.
14) What is a record?
* A record is complete information about a subject. A record is a collection of fields and presented as a row in a table of database.
15) What is a query?
* A query is a question about data in database. It results a set of data from database that can be used as a source of records for reports and forms.
16) What is a form?
*Entering and viewing data directly on the database table is not always convenient. So, a form is created to facilitate easy entering data and created that retrieve records from a single table or from multiple tables.
17) What is a report? A report is an object in MS-Access that is used to view and print data. Though a Report is similar to a form; its specialty lies in special features like help to summarize data.
18) What are the differences between a form and a report? *Forms are primarily used to edit overview data whereas reports are used primarily to print or view data. In a form your usually navigate from one record to another, whereas in reports summarized data are possible to present.
19) What is a macro?
*A macro is an object in MS-Access that is used to execute one or more database commands automatically. Macros are useful in tasks such as printing month-end reports, adding new record to a table, printing letters to customers periodically.
20) What is a module?
* A module object in Access is a program written using VBA (Visual Basic for Application) to automate and customize database function.
Subscribe to:
Comments (Atom)
Featured post
check box
<!DOCTYPE html> <html> <head> <title>Check Box</title> </head> <body> <input ty...
-
public class ChickenAndRabbits { public static void main(String arga[]) { int a=35; int b=94; int c=a*2; int d=(b-c)/2; System.out.println(...
-
<!DOCTYPE html> <html> <head> <title>List Style</title> <style> .ul1 { list-...