Correct use of java-class names

Source: Internet
Author: User


Import Java.util.Scanner;

public class Demoscanner {

* @param args
* 1. If the class name is the same as the existing class name, then it will be overwritten by others, some functions of the existing class can not be realized, such as the above Demoscanner class
* If the name is scanner, the class of the system will be overwritten
* 2. In general, the first letter of the class name, such as Primenumber, the method first letter lowercase such as getname ()
public static void Main (string[] args) {
Scanner sc=new Scanner (; Keyboard entry
int I=sc.nextint (); Keyboard input integer stored in I
System.out.println (i);
if (Sc.hasnextint ())///determines whether the input int value is true public boolean hasnextint () {
Return Hasnextint (Defaultradix);
int I=sc.nextint ();
System.out.println (i);
System.out.println ("Wrong type of input");

Correct use of java-class names

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: 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.