MY mENU


Wednesday, 9 January 2013

Java Basics


Can we create empty java file, can we compile and execute it?
Yes, but after compilation we do not have .class. so we cannot execute.

Can we create empty class; can we compile and execute it?
Yes we can create and compile empty class. Compiler generates .class file with that class name. we cannot execute this class because this class does not have main method. It leads to exception.

When should be the java file name and class name be the same?
If class is declared as public, file name should be the same as the public class name, else its name can be user defined.

If a java file has multiple classes what is the java file name?
Public class name. If there no public class than java file name can be user defined.
In java file we can define only one public class and multiple non- public class names.

If we compile multiple classes’ java file, how many .class files are generated by compiler?
Compiler generates .class files as many class definitions as we have in that java file. Compiler generates .class file separately for every class with that class name.

User Defined method and Predefined method: Developer defined method is called user defined or custom method. Java software developers given method is called predefined method. It means already implemented methods are called predefined methods. Ex: println () method.

User Defined and Predefined classes: Developer defined class is called user defined or custom class. Java Software developers given class is called predefined class. It means already implemented classes are called predefined classes. Ex: System, String…

If a class does not have main method, how can we execute that class user defined methods?
We should use another class main method. We should call this method with its class name. In projects, we do not write main method in every class. Instead we write main method in one class, and we will call all other classes’ methods from this class’s main method for testing.

Basically main method is given to start class logic execution but not for developing logic directly.

We can define user defined methods with same name in multiple classes. While calling those methods we must use that method’s class name.
We can call main method explicitly with this syntax:  main(new String [0]);

Println () method places the cursor in the next line after printing current output. So that the next coming output will be printed in next line.
But whereas print () method places the cursor in the same line after printing current output. So that next coming output will be printed in same line.

Naming Conventions:

Naming a class: class name should be “Noun”, and should be in title case “every word first letter should be capital”

Naming a Variable: Variable name should be “Noun”, and should be in case “every word first letter should be small after that every word first letter should be capital”

In final variables all its letters should be capital and words must be connected with ‘_’. 
MIN_BALANCE

Naming a Method: Method name should be “Verb”, because it represents action, and should be in case “every word first letter should be small after that every word first letter should be capital and should follow ()
Ex: getUserName()

Naming Package: all letters are small, and its length should be a short as possible.

Monday, 7 January 2013

Steps for JSP request:

  1. When the user goes to a JSP page web browser makes the request via internet.
  2. JSP request gets sent to the Web server.
  3. Web server recognises the .jsp file and passes the JSP file to the JSP Servlet Engine.
  4. If the JSP file has been called the first time,the JSP file is parsed,otherwise Servlet is instantiated.
  5. The next step is to generate a special Servlet from the JSP file. All the HTML required is converted to println statements.
  6. The Servlet source code is compiled into a class.
  7. The Servlet is instantiated,calling the init and service methods.
  8. HTML from the Servlet output is sent via the Internet.
  9. HTML results are displayed on the user's web browser

Thursday, 27 December 2012

SQL SERVER – What is – DML, DDL, DCL and TCL – Introduction and Examples


SQL SERVER – What is – DML, DDL, DCL and TCL – Introduction and Examples

DML is abbreviation of Data Manipulation Language. It is used to retrieve, store, modify, delete, insert and update data in database.
Examples: SELECT, UPDATE, INSERT statements
DDL
DDL is abbreviation of Data Definition Language. It is used to create and modify the structure of database objects in database.
Examples: CREATE, ALTER, DROP statements
DCL
DCL is abbreviation of Data Control Language. It is used to create roles, permissions, and referential integrity as well it is used to control access to database by securing it.
Examples: GRANT, REVOKE statements
TCL
TCL is abbreviation of Transactional Control Language. It is used to manage different transactions occurring within a database.
Examples: COMMIT, ROLLBACK statements