Discover simple shopping cart program in java, include the articles, news, trends, analysis and practical advice about simple shopping cart program in java on alibabacloud.com
In the previous article to introduce the MyEclipse connection MySQL database method, through this article to introduce how to access the MySQL database in the Java program data and simple operation, details please see below.
Create a Javaproject and enter the following Java code:
Package link;
Import java.sql.*
"*", 3 means "/" private JButton b[] = new JBUTTON[12]; Create an array with 12 buttons private JButton b1,b2,b3,b4,b5,b6,b7,b8; Arithmetic function button public ex5_2 () {super ("simple Calculator"); Window name Container c = Getcontentpane ();
Create a content panel object t1 = new JTextField (30); T1.seteditable (FALSE);
Can only be displayed, cannot edit t2 = new JTextField (30); T2.seteditable (FALSE); Can only display, cannot edit
The first step is to build a Java project
File->new->java Project
Figure 1
Click Finish
Step two Create a class file
Right-click the project file name Myjava->new->class
Figure 2
Click Finish
The editing interface appears
Step three edit the code
Fourth step execution of the project
Right-click the project
Import java.net. *;Import java.io. *; Public class Server { Public Staticvoid Main(String[]args) throws Exception{ while(true){//Keep running ServerSocketServer= New ServerSocket( the);//Monitor on port 80 SocketSock=Server.Accept ();//Create a socket with the clientFileInputStream in = new fileinputstream("c:\\a\\1.html"); //Read Data OutputStream out = sock. Getoutputstream ();int len = 0; byte buffer[] = new byte[1024x768]; //Buffer while (Len=in.read (buffer))>0) {
when using netstat query port, always can not see the name of the program, you must also cooperate with PS to the process number intersection, a two can, often need to see the words are silly, this script is to solve such a pain point, especially to optimize the Java program memory. on a night of Black nights, I had a long-running awk code, and finally did it, an
Following the "Simple Java Capture Program", this will complete the collection task for the entire site's number segment. "Using precompilation + batching to capture Web page content into a database table" Before we used the statement class to create the execution object of the SQL statement to implement the operation of inserting the field into the database, but
System.out.println (s);8 }9 }Ten One Public classExmple { A Public Static voidMain (String args[]) - {Xiyourenwu zhubajie,sunwukong; -Zhubajie=NewXiyourenwu (); thesunwukong=NewXiyourenwu (); -zhubajie.height=1.80f;//object assigns a value to its own variable. -zhubajie.weight=160f; -Zhubajie.hand= "Two black Hands"; +zhubajie.foot= "Two Feet"; -Zhubajie.head= "Big Head"; +Zhubajie.ear= "A pair of big ears"; AZhubajie.mouth= "a big Mouth"; atsunwukong.height=1.62f;//object assigns
second Gongneng module write a bit cumbersome.3 Gongneng module is used in the switch inside the nested if loop, because before the class has defined three global variables, so these three quantities in any module here can be used directly; here it should be realized you withdraw money, save and then go to check the balance, the balance will have corresponding changes , but if you check the balance first, you will find that the balance cannot correspond to the balance you have defined above. It
Project Introduction
Project : In our classroom, there are generally 3-5 times the class attendance opportunities. In the past years, teachers are in the time sheet marking, this year is not the same, let us write a program, the attendance data saved to the computer.
Available data, student list file: list.txt (Download address: http://pan.baidu.com/s/1hqxECIw)
201011621305 Chen Guangsen201111621301 Cao Paoin201111621306 Chen Ka-ho201111621313 Chen J
, select the Maven profile, and then click the "Reindex" button below to update the index.Second, to write a simple addition programTo create a new MAVEN project:1. Select Menu File-new-maven project, tick "Create a simple project (skip archetype selection)"2. Create a new MAVEN project and set the project properties as followsAddition Program key CodeAddaction.j
Import Javax.swing.JOptionPane; Import Class Joptionpanepublic class addition {public static void main (string args[]) {string firstnumber, First string entered by user Secondnumber; Second string entered by the user int number1,//First number to add number2,//second Nu Mber to add sum,//Sum of Number1 and Number2 Mul, Sub,div; Read in first number from user as a string firstnumber = Joptionpane.showinputdialog ("Enter First integer " ); Read in second number from user as a string
{public
static void Main (string[] args)
{
Scanner s=new Scanner (system.in);
System.out.println ("Please enter the Year");
int Nianfen=s.nextint ();
if (nianfen%4==0nianfen%100!=0| | nianfen%400==0) {System.out.println (nianfen+ "Years is a leap year");}
The year can be divisible by 4 but cannot be divisible by 100, or the year can be divisible by 400
else{system.out.println (nianfen+ "Year is not leap years");}}
The above is a small series for everyone to use
= "0f0000000373656c656374202768656c6c6f27";
Bytes=converthexstrtobytearray (HEXS);
Bos.write (bytes,0,19);
Bos.flush (); Byte[]converthexstrtobytearray (Stringhexs) {byte[]a=newbyte[hexs.length ()/2
];
intindex=0;
For (Inti=0;i After running the above program, the corresponding Wireshark crawl information is: The 1th line in the above code corresponds to 140~144, the above code line 10th corresponds to 145~147, and the remaining corresponding se
I was most interested in web crawlers and began to learn how to write web crawlers. I read a day's book and summarize my learning achievements.
Web Crawler is a script or program that automatically captures World Wide Web Information Based on certain rules. This article is a small program written in Java that crawls web content from a specified URL and saves it l
/**
* This is a test program for echo server. @ author Hu Dennis created at 2008-11-12
*/
Import java.net. serversocket;
Import java.net. Socket;
Import java. Io. bufferedreader;
Import java. Io. datainputstream;
Import java. Io. ioexception;
Import java. Io. input
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.