Java Trivia points

Source: Internet
Author: User
Tags first string

1. To turn a string into an integer, generally in the algorithm involves the calculation of large numbers need to use

Class  test{public static void Main (string[] args) {         strings= "233123"; int i=integer.parseint (s);  Error System.out.println (i) when there are non-numbers in S

2. For the processing of negative numbers, first determine whether it is negative, and then remove the minus sign to calculate, after the calculation and add

Class  test{public static void Main (string[] args) {    strings= " -233123"; int i=integer.parseint (s);//float SOURCEF = S.parsefloat (SOURCESTR); becomes floating point//system.out.println ("Hello world!" +i); char frist = S.charat (0);    Gets the first character of the string   //if (frist== '-') {System.out.println (frist);} Determines whether the first character is a-//system.out.println (frist); String leave = s.substring (1,s.length ()); Intercepts all characters except the first string//system.out.println (leave); String NewS = string.valueof (i);   Turns an integer into a string   System.out.println (NewS);   String add = "-" +s;   Stitching string  //System.out.println (add);}}

3.java Processing of linked lists

Java Trivia points

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.