JSP Tutorial: Preliminary Contact Learning JSP Grammar Basics

Source: Internet
Author: User
Tags iis integer variables relative return variable tostring wrapper
js| Tutorials | grammar The concept of client and server-side (server-based)

Server: Broadly speaking, servers are divided into two types (hardware servers, software servers)
Hardware server: Refers to the relative PC, the performance and stability of the better, the use of special hardware computer.
Software server: Colloquially, refers to the installation of some kind of service software, and can provide the corresponding service machine, we call it the server.

There are many kinds of service software, which are common:
WWW service software: PWS, IIS, APACHE
Java EE Middleware Application server: WebSphere, Silverstream
JSP engine (Weak WWW service function): Tomcat,resin,weblogic,jrun
SMTP, Pop3:iis's Smtp,exchange,lotus Domino
Ftp:iis with

Client: Relative to the server, is to enjoy a certain kind of service side, is called the client. However, to enjoy a service you must also install the appropriate software, such as (Ie/netscape, Outlook/foxmail, CuteFTP)


Data Type

The basic types have the following four kinds:
int length data types are: Byte (8bits), short (16bits), int (32bits), Long (64bits)
Float length data types are: Single precision (32bits float), double precision (64bits double)
Boolean-type variables have the values: Ture, False
Char data types are: Unicode characters, 16-bit
Corresponding class type: Integer, Float, Boolean, Character, Double, short, Byte, Long

Conversion principles:

Converts byte, short, int, long, float, double, char from low precision to high precision
Note: Two char operations, automatically converted to int, when char and other types of operations, will be automatically converted to int type, and then do other types of automatic conversion

1, the base type converts to the class type

Forward Conversion:
To create a new class-type variable by using the class wrapper
Integer a= new Integer (2);

Reverse Conversion:
Converting by class Wrapper
int B=a.intvalue ();

2, class type to string conversion

Forward Conversion:
Because each class is a subclass of the object class, and all object classes have a ToString () function, you can convert it by using the ToString () function.

Reverse Conversion:
To create a new class-type variable from the class wrapper
Eg1:int i=integer.valueof ("123"). Intvalue ()
Description: The above example converts a string into an integer object, and then calls the object's Intvalue () method to return its corresponding int value.
Eg2:float f=float.valueof ("123"). Floatvalue ()
Description: The above example converts a string into a float object, and then calls the object's Floatvalue () method to return its float value.
Eg3:boolean b=boolean.valueof ("123"). Booleanvalue ()
Description: The above example converts a string into a Boolean object, and then calls the object's Booleanvalue () method to return its corresponding Boolean value.
Eg4:double d=double.valueof ("123"). Doublevalue ()
Description: The above example converts a string into a double, and then calls the object's Doublevalue () method to return its double value.
Eg5:long l=long.valueof ("123"). Longvalue ()
Description: The above example converts a string to a long object, and then calls the object's Longvalue () method to return its long value.
Eg6:char=character.valueof ("123"). Charvalue ()
Description: The above example converts a string into a character object, and then calls the object's Charvalue () method to return its corresponding char value.

3, conversion of basic type to string

Forward Conversion:
such as: int a=12;
String b;
B=a+ "";

Reverse Conversion:
Through the class wrapper
Eg1:int I=integer.parseint ("123")
Note: This method can only be applied to strings converted to integer variables
Eg2:float f=float.valueof ("123"). Floatvalue ()
Description: The above example converts a string into a float object, and then calls the object's Floatvalue () method to return its float value.
Eg3:boolean b=boolean.valueof ("123"). Booleanvalue ()
Description: The above example converts a string into a Boolean object, and then calls the object's Booleanvalue () method to return its corresponding Boolean value.
Eg4:double d=double.valueof ("123"). Doublevalue ()
Description: The above example converts a string into a double, and then calls the object's Doublevalue () method to return its double value.
Eg5:long l=long.valueof ("123"). Longvalue ()
Description: The above example converts a string to a long object, and then calls the object's Longvalue () method to return its long value.
Eg6:char=character.valueof ("123"). Charvalue ()
Description: The above example converts a string into a character object, and then calls the object's Charvalue () method to return its corresponding char value.

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.