8、Java编程:代码注释、数学运算、变量使用与用户输入处理

Java编程:代码注释、数学运算、变量使用与用户输入处理

1. 代码注释的使用

在Java编程中,注释是一种非常有用的工具,它可以帮助我们解释代码的功能和用途,也能提醒我们在开发过程中使用特定代码版本的原因。

我们可以通过创建一个名为 CommentingCode.java 的Java类文件来实验基本的注释方法。以下是示例代码:

package com.sg.foundations.basics.core;

public class CommentingCode {

    public static void main(String[] args) {

        // Comments are written to explain code in an easily
        // understandable way
        // Basically for single lines
        // anything after // is considered a comment
        System.out.println("Normal code is compiled and runs ...");
        System.out.println("Comments however ... ");// do not execute!

        // Comments can be on their own line
        System.out.println("..."); // or they can share l
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值