Tampilkan postingan dengan label Popular. Tampilkan semua postingan
public static void main(String args[])
{
//your code......
}
Next, the JVM runs everything between the curly braces{} of your main method. Every Java application has to have at least one Class, and at least one main method (not one main per class; just one main per application).

In Java, everything goes in a class. Your'll type your source code file (with a .java extension), then compile it into a new class file (with a .class extension). When your run your program, you're really running a class.
Running a program means telling the Java Virtual Machine (JVM) to "Load the 9lessons class, then start executing its main() method. Keep running till all the code in main is finished.
The main() method is where your program starts running.
9lessons.java
public class 9lessons
{
public static void main(String[] args)
{
System.out.println("Programming Blog");
}
}

step 1: javac 9lessons.java
step 2: java 9lessons
The Big Difference Between public class and Default class
9lessons.java
public class program
{
public static void main(String[] args)
{
System.out.println("Programming Blog");
}
}
Above programe file name is (9lessons.java) and public class name (program) is different

Error : Class program is public, should be declared in a file named program.java
So public class means file name and class name must be same..
Here Default Class(no public)
9lessons.java
class program
{
public static void main(String[] args)
{
System.out.println("Programming Blog");
}
}

After compiling 9lesson.java creates program.class

In the Defalult class no need to give file name and class name same..
step 1: javac 9lessons.java
step 2: java program
If any mistakes please comment me..
Related Articles:
Connecting JSP To Mysql Database Lesson
Web.xml Deployment Descriptor
Rating: 4.5
Reviewer: Unknown
ItemReviewed: Analysis of a Java Class
In Google, the web crawling (downloading of web pages) is done by several distributed crawlers. There is a URLserver that sends lists of URLs to be fetched to the crawlers. The web pages that are fetched are then sent to the storeserver. The storeserver then compresses and stores the web pages into a repository.Every web page has an associated ID number called a docID which is assigned whenever a new URL is parsed out of a web page. The indexing function is performed by the indexer and the sorter. The indexer performs a number of functions. It reads the repository, uncompresses the documents, and parses them. Each document is converted into a set of word occurrences called hits.
High Level Google Architecture

The hits record the word, position in document, an approximation of font size, and capitalization. The indexer distributes these hits into a set of "barrels", creating a partially sorted forward index. The indexer performs another important function. It parses out all the links in every web page and stores important information about them in an anchors file. This file contains enough information to determine where each link points from and to, and the text of the link.
The URLresolver reads the anchors file and converts relative URLs into absolute URLs and in turn into docIDs. It puts the anchor text into the forward index, associated with the docID that the anchor points to. It also generates a database of links which are pairs of docIDs. The links database is used to compute PageRanks for all the documents.

The sorter takes the barrels, which are sorted by docID, and resorts them by wordID to generate the inverted index. This is done in place so that little temporary space is needed for this operation. The sorter also produces a list of wordIDs and offsets into the inverted index. A program called DumpLexicon takes this list together with the lexicon produced by the indexer and generates a new lexicon to be used by the searcher. The searcher is run by a web server and uses the lexicon built by DumpLexicon together with the inverted index and the PageRanks to answer queries.
Next Article LinkGoogle Search Major Data Structures Documentation
Rating: 4.5
Reviewer: Unknown
ItemReviewed: Google Search Architecture Overview
Tomcat Directory Structure

Login.java
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class Login extends HttpServlet{
public void doGet(HttpServletRequest request,
HttpServletResponse response)throws IOException{
PrintWriter out=response.getWriter();
java.util.Date tody=new java.util.Date();
out.println("out put html tags");
}
}
<servlet>Maps internal name to fully-qualified class name.
<servlet-mapping>Maps internal name to public URL name.
web.xml

<servlet-mapping> which servlet should i invoke for this requested URL?
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-app_2_4.xsd" version="2.4">
<servlet>
<servlet-name>Servlet_login</servlet-name>
<servlet-class>Login</servlet-class>
</servlet>
<servlet>
<servlet-name>Servlet_inbox</servlet-name>
<servlet-class>inbox</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Servlet_login</servlet-name>
<url-pattern>/signin.do</usr-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Servlet_inbox</servlet-name>
<url-pattern>/view.do</usr-pattern>
</servlet-mapping>
</web-app>
signin.do file mapping to Login.class. So the client or users to get to the servlet.. but it's a made-up name that is NOT the name of the actual servlet class.

Rating: 4.5
Reviewer: Unknown
ItemReviewed: Web.xml Deployment Descriptor
What's in a Database?
a database is a container that holds tables and other SQL structures related to those tables.
An easier way to diagram accout table.
Every one having different hobbies. Remove the hobbiles column and put it in its own table
Add name colum that will let us identify which hobbies belong to which person in the account table.
Linking two tables in a diagram

Connecting Two tables

The problem we're trying to use name field to somehow let use connect the two tables. But what if two people in the accout table have the same name ?

Foreing Key Facts :
A foreign key can have a different name that the primary key it comes form.
The primary key used by a foreign key is also knownas a parent key. the table where the primary key is from is knows as a parent table.
The foreing key can be used to make sure that the rows in on table have corresponding rows in another table.
Foreign key values can be null, even thugh primary key values can't.
Foreign key don't have to be unique - in facts, they ofter aren't
CREATE TABLE accout(
user_id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(20),
email VARCHAR(30),
birthday DATE,
gender VARCHAR(10),
city VARCHAR(30));

CREATE TABLE hobbies(
hob_id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,hobby VARCHAR(100) NOT NULL,
user_id INT NOT NULL,
CONSTRAINT account_user_id_fK
FOREIGN KEY(user_id)
REFERENCES accout(user_id));

Rating: 4.5
Reviewer: Unknown
ItemReviewed: What is FOREIGN KEY? Easy Lesson

