Java面向对象之创建和使用对象——定义学生/教师类并输出相关信息

Java面向对象之创建和使用对象——定义学生/教师类并输出相关信息学生类importjava.util.Scanner;publicclassStudent{Stringname=”张三”;intage=16;Stringgrade=”三年二班”;Stringfancy=”打篮球唱歌读书冒险”;publicvoidintroduce(){System.out.println(“————————————-

大家好,又见面了,我是你们的朋友全栈君。

学生类

import java.util.Scanner;

public class Student { 
   

    String name = "张三";
    int age = 16;
    String grade = "三年二班" ;
    String fancy = "打篮球 唱歌 读书 冒险";

    public void introduce(){ 
   

        System.out.println("-----------------------------------------------------");
        System.out.println("姓名:" + name + "\n年龄:" + age + "\n班级:" + grade);
        System.out.println("兴趣爱好:" + fancy);
    }

    public void init(){ 
   

        Scanner sc = new Scanner(System.in);
        System.out.print("请输入姓名:");
        name = sc.nextLine();
        System.out.print("请输入年龄:");
        age = sc.nextInt();
        System.out.print("请输入班级:");
        grade = sc.next();
        System.out.print("请输入兴趣爱好:");
        fancy = sc.next();
    }

    public static void main(String[] args){ 
   

        Student student = new Student();
        student.init();
        student.introduce();

    }
}

在这里插入图片描述

教师类,输出教师相关信息

import java.util.Scanner;

public class Teacher { 
   

    String name = "李四";
    int age = 10;
    String major = "计算机视觉" ;
    String course = "计算机网络 操作系统 数据结构 数据库";

    public void introduce(){ 
   

        System.out.println("-----------------------------------------------------");
        System.out.println("姓名:" + name + "\n教龄:" + age + "年\n专业方向:" + major);
        System.out.println("教授课程:" + course);
    }

    public void init(){ 
   

        Scanner sc = new Scanner(System.in);
        System.out.print("请输入姓名:");
        name = sc.nextLine();
        System.out.print("请输入教龄:");
        age = sc.nextInt();
        System.out.print("请输入专业方向:");
        major = sc.next();
        System.out.print("请输入教授课程:");
        course = sc.next();
    }

    public static void main(String[] args){ 
   

        Teacher teacher = new Teacher();
        //teacher.init();
        teacher.introduce();

    }
}

在这里插入图片描述

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/156721.html原文链接:https://javaforall.cn

【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛

【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...

(0)


相关推荐

  • JQuery 学习—$.each遍历学习

    生活在这样一个充满欢乐的世界中,我们要有欢乐的精神对待工作和生活! 我们每天晚上睡觉早上起来,每天会重复着做很多的事情,我们的生活在程序的角度看其实就是一个循环,这个循环说简单它就简单,说复杂它就很复杂。今天我要用欢乐的方式来介绍的是JQuery的中的一种技术,JQuery 的$.each遍历操作,不管是搞前端还是搞后端javaWeb方向的程序员(猿),一定会和它偶遇,在每一个转角。

  • javascript nextSibling属性「建议收藏」

    javascript nextSibling属性「建议收藏」对于nextSibling属性,在W3school中的定义为:nextSibling属性返回指定节点之后紧跟的节点,在相同的树层级中。注意所返回的节点必须是与上一个节点是同级关系,且彼此之间不能有空格,否则将会返回:undefinedTitl</p> </div> <div class="item-meta"> <div class="item-meta-li author"> <a data-user="1" target="_blank" href="https://javaforall.cn/user-2/1" class="avatar j-user-card"> <img alt='全栈程序员-用户IM' src='//javaforall.cn/wp-content/uploads/2020/10/2020101714281065.jpg' class='avatar avatar-60 photo' height='60' width='60' /> <span>全栈程序员-用户IM</span> </a> </div> <span class="item-meta-li date">2022年7月13日</span> <div class="item-meta-right"> </div> </div> </div> </li> <li class="item"> <div class="item-img"> <a class="item-img-inner" href="https://javaforall.cn/218629.html" title="产品经理面试内容_产品专员简历" target="_blank" rel="bookmark"> <img class="j-lazy" src="http://javaforall.cn/wp-content/themes/justnews/themer/assets/images/lazy.png" data-original="https://javaforall.cn/wp-content/uploads/2020/11/2020110817443450-480x300.jpg" width="480" height="300" alt="产品经理面试内容_产品专员简历"> </a> </div> <div class="item-content"> <h4 class="item-title"> <a href="https://javaforall.cn/218629.html" target="_blank" rel="bookmark"> 产品经理面试内容_产品专员简历 </a> </h4> <div class="item-excerpt"> <p>产品经理面试内容_产品专员简历前言经过深思熟路后,本渣决定参加放弃研发转投产品了。本科,硕士所学的东西也不能说可惜,这些都会帮助我在产品岗位更进一步。那么在研究与学习之下,我来研究一下产品经理的简历如何投能不当炮灰。(现在写好加深一下印象,也方便一下一年后写简历参加秋招的小周。)思路:PM的面试简历,就是一份产品产品用户:HR,业务主管简历被HR的阅读时间很短,15S左右,且较为粗略。所以就需要满足d…</p> </div> <div class="item-meta"> <div class="item-meta-li author"> <a data-user="1" target="_blank" href="https://javaforall.cn/user-2/1" class="avatar j-user-card"> <img alt='全栈程序员-用户IM' src='//javaforall.cn/wp-content/uploads/2020/10/2020101714281065.jpg' class='avatar avatar-60 photo' height='60' width='60' /> <span>全栈程序员-用户IM</span> </a> </div> <span class="item-meta-li date">2022年10月28日</span> <div class="item-meta-right"> </div> </div> </div> </li> <li class="item"> <div class="item-img"> <a class="item-img-inner" href="https://javaforall.cn/134899.html" title="网孔型高级维修电工实训装置" target="_blank" rel="bookmark"> <img class="j-lazy" src="http://javaforall.cn/wp-content/themes/justnews/themer/assets/images/lazy.png" data-original="https://javaforall.cn/wp-content/uploads/2020/11/2020110817443450-480x300.jpg" width="480" height="300" alt="网孔型高级维修电工实训装置"> </a> </div> <div class="item-content"> <h4 class="item-title"> <a href="https://javaforall.cn/134899.html" target="_blank" rel="bookmark"> 网孔型高级维修电工实训装置 </a> </h4> <div class="item-excerpt"> <p>网孔型高级维修电工实训装置ZN-88CCV网孔型高级维修电工实训装置一、概述ZN-88CCV网孔型高级维修电工实训装置主要由实训桌、网孔板、实训元器件(也可自购)组成。学生根据实训线路进行元器件的合理布局,安装、接线全部由学生自行完成,接近工业现场,能完成电工基础电路,电机控制线路,照明配电的模拟操作,PLC可编程综合应用线路,电子技术应用电路的综合实训,通过一系列项目实训培养学生动手能力和实操技能。实训项目可自行确定,根据所选的项目选择相应的元器件。该装置也可作为电工考工的考核设备。二、特点1、实训采用网孔板与挂箱相结合</p> </div> <div class="item-meta"> <div class="item-meta-li author"> <a data-user="1" target="_blank" href="https://javaforall.cn/user-2/1" class="avatar j-user-card"> <img alt='全栈程序员-用户IM' src='//javaforall.cn/wp-content/uploads/2020/10/2020101714281065.jpg' class='avatar avatar-60 photo' height='60' width='60' /> <span>全栈程序员-用户IM</span> </a> </div> <span class="item-meta-li date">2022年6月6日</span> <div class="item-meta-right"> </div> </div> </div> </li> <li class="item item-myimg"><div class="wpcom_myimg_wrap __flow"><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-2738972289555236" crossorigin="anonymous"></script> <ins class="adsbygoogle" style="display:block" data-ad-format="fluid" data-ad-layout-key="-f3-8+77-5f+d3" data-ad-client="ca-pub-2738972289555236" data-ad-slot="8678175991"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script></div></li><li class="item"> <div class="item-img"> <a class="item-img-inner" href="https://javaforall.cn/190016.html" title="c语言十进制小数转二进制代码_c语言十进制转换成二进制" target="_blank" rel="bookmark"> <img class="j-lazy" src="http://javaforall.cn/wp-content/themes/justnews/themer/assets/images/lazy.png" data-original="https://javaforall.cn/wp-content/uploads/2020/11/2020110817443450-480x300.jpg" width="480" height="300" alt="c语言十进制小数转二进制代码_c语言十进制转换成二进制"> </a> </div> <div class="item-content"> <h4 class="item-title"> <a href="https://javaforall.cn/190016.html" target="_blank" rel="bookmark"> c语言十进制小数转二进制代码_c语言十进制转换成二进制 </a> </h4> <div class="item-excerpt"> <p>c语言十进制小数转二进制代码_c语言十进制转换成二进制十进制转二进制,整数部分采用除以二取余,小数部分采用乘以二取整。网上大多数转换都是针对整数的,这里写一个小数的做个纪念#include#includeintmain(){doublea=0.2784;inti=0;printf(“0.”);for(i=0;i<18;i++){if(a*2>1)</p> </div> <div class="item-meta"> <div class="item-meta-li author"> <a data-user="1" target="_blank" href="https://javaforall.cn/user-2/1" class="avatar j-user-card"> <img alt='全栈程序员-用户IM' src='//javaforall.cn/wp-content/uploads/2020/10/2020101714281065.jpg' class='avatar avatar-60 photo' height='60' width='60' /> <span>全栈程序员-用户IM</span> </a> </div> <span class="item-meta-li date">2022年9月24日</span> <div class="item-meta-right"> </div> </div> </div> </li> <li class="item"> <div class="item-img"> <a class="item-img-inner" href="https://javaforall.cn/129833.html" title="datagrip安装教程与激活_激活" target="_blank" rel="bookmark"> <img class="j-lazy" src="http://javaforall.cn/wp-content/themes/justnews/themer/assets/images/lazy.png" data-original="https://javaforall.cn/wp-content/uploads/2022/04/jihuoma-suoluetu-480x300.jpeg" width="480" height="300" alt="datagrip安装教程与激活_激活"> </a> <a class="item-category" href="https://javaforall.cn/category/%e5%bc%80%e5%8f%91%e5%b7%a5%e5%85%b7" target="_blank">开发工具</a> </div> <div class="item-content"> <h4 class="item-title"> <a href="https://javaforall.cn/129833.html" target="_blank" rel="bookmark"> datagrip安装教程与激活_激活 </a> </h4> <div class="item-excerpt"> <p>datagrip安装教程与激活_激活Datagrip激活码最新破解教程,Mac版激活至2299年,Datagrip激活码2021.3.3</p> </div> <div class="item-meta"> <div class="item-meta-li author"> <a data-user="1" target="_blank" href="https://javaforall.cn/user-2/1" class="avatar j-user-card"> <img alt='全栈程序员-用户IM' src='//javaforall.cn/wp-content/uploads/2020/10/2020101714281065.jpg' class='avatar avatar-60 photo' height='60' width='60' /> <span>全栈程序员-用户IM</span> </a> </div> <span class="item-meta-li date">2022年4月20日</span> <div class="item-meta-right"> </div> </div> </div> </li> </ul> </div> <div id="comments" class="entry-comments"> <div id="respond" class="comment-respond"> <h3 id="reply-title" class="comment-reply-title">发表回复</h3><form action="http://javaforall.cn/wp-comments-post.php" method="post" id="commentform" class="comment-form" novalidate><p class="comment-notes"><span id="email-notes">您的电子邮箱地址不会被公开。</span> <span class="required-field-message" aria-hidden="true">必填项已用<span class="required" aria-hidden="true">*</span>标注</span></p><div class="comment-form-comment"><textarea autocomplete="new-password" id="j265fd99e5" name="j265fd99e5" class="required" rows="4" placeholder="写下你的评论…"></textarea><textarea id="comment" aria-label="hp-comment" aria-hidden="true" name="comment" autocomplete="new-password" style="padding:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;position:absolute !important;white-space:nowrap !important;height:1px !important;width:1px !important;overflow:hidden !important;" tabindex="-1"></textarea><script data-noptimize>document.getElementById("comment").setAttribute( "id", "a7d1548ba303a16f9e18cc2fab949bee" );document.getElementById("j265fd99e5").setAttribute( "id", "comment" );</script><div class="comment-form-smile j-smilies" data-target="#comment"><i class="wpcom-icon wi smile-icon"><svg aria-hidden="true"><use xlink:href="#wi-emotion"></use></svg></i></div></div><div class="comment-form-author"><label for="author">昵称:</label><input id="author" name="author" type="text" value="" size="30"></div> <div class="comment-form-email"><label for="email">邮箱:</label><input id="email" name="email" type="text" value=""></div> <div class="comment-form-url"><label for="url">网址:</label><input id="url" name="url" type="text" value="" size="30"></div> <label class="comment-form-cookies-consent"><input id="wp-comment-cookies-consent" name="wp-comment-cookies-consent" type="checkbox" value="yes"> 记住昵称、邮箱和网址,下次评论免输入</label> <div class="form-submit"><button name="submit" type="submit" id="submit" class="btn btn-primary btn-xs submit">提交</button> <input type='hidden' name='comment_post_ID' value='156721' id='comment_post_ID' /> <input type='hidden' name='comment_parent' id='comment_parent' value='0' /> </div></form> </div><!-- #respond --> </div><!-- .comments-area --> </article> </main> <aside class="sidebar"> <div class="widget widget_profile"><div class="profile-cover"><img class="j-lazy" src="https://javaforall.cn/wp-content/themes/justnews/themer/assets/images/lazy.png" data-original="//qn.javajgs.com/javaforall/%E4%B8%AA%E4%BA%BA%E5%B0%81%E9%9D%A2.jpeg" alt="全栈程序员-用户IM"></div> <div class="avatar-wrap"> <a target="_blank" href="https://javaforall.cn/user-2/1" class="avatar-link"><img alt='全栈程序员-用户IM' src='//javaforall.cn/wp-content/uploads/2020/10/2020101714281065.jpg' class='avatar avatar-120 photo' height='120' width='120' /></a></div> <div class="profile-info"> <a target="_blank" href="https://javaforall.cn/user-2/1" class="profile-name"><span class="author-name">全栈程序员-用户IM</span></a> <p class="author-description">本网站汇聚当前互联网主流语音,持续更新,欢迎关注公众号“全栈程序员社区”</p> <div class="profile-stats"> <div class="profile-stats-inner"> <div class="user-stats-item"> <b>93.1K</b> <span>文章</span> </div> <div class="user-stats-item"> <b>0</b> <span>粉丝</span> </div> </div> </div> <button type="button" class="btn btn-xs btn-follow j-follow btn-primary" data-user="1"><i class="wpcom-icon wi"><svg aria-hidden="true"><use xlink:href="#wi-add"></use></svg></i>关注</button> </div> <div class="profile-posts"> <h3 class="widget-title"><span>最近文章</span></h3> <ul> <li><a href="https://javaforall.cn/234049.html" title="二分查找算法(C语言实现)[通俗易懂]">二分查找算法(C语言实现)[通俗易懂]</a></li> <li><a href="https://javaforall.cn/234048.html" title="c# 看门狗 程序_看门狗制作东西怎么切换">c# 看门狗 程序_看门狗制作东西怎么切换</a></li> <li><a href="https://javaforall.cn/234047.html" title="Java常用代码_计算机植入木马程序">Java常用代码_计算机植入木马程序</a></li> <li><a href="https://javaforall.cn/234046.html" title="GPS通讯协议(NMEA0183)协议解析_台积电回应芯片巨头撤离">GPS通讯协议(NMEA0183)协议解析_台积电回应芯片巨头撤离</a></li> <li><a href="https://javaforall.cn/234045.html" title="vmware找不到vmx文件_虚拟机重启后文件丢失">vmware找不到vmx文件_虚拟机重启后文件丢失</a></li> <li><a href="https://javaforall.cn/234054.html" title="idea删除项目「建议收藏」">idea删除项目「建议收藏」</a></li> <li><a href="https://javaforall.cn/234053.html" title="C++ 单例模式_c 单例模式">C++ 单例模式_c 单例模式</a></li> <li><a href="https://javaforall.cn/234052.html" title="python 字符串 转义_python转义字符怎么用">python 字符串 转义_python转义字符怎么用</a></li> <li><a href="https://javaforall.cn/234051.html" title="激活成功教程ftp密码代码">激活成功教程ftp密码代码</a></li> <li><a href="https://javaforall.cn/234050.html" title="UHF与VHF_美官员承认乌克兰有美军事人员">UHF与VHF_美官员承认乌克兰有美军事人员</a></li> </ul> </div> </div><div class="widget widget_html_myimg">http://www.javaforall.cn <div class="_58auf8w3dmd"></div> <script type="text/javascript"> (window.slotbydup = window.slotbydup || []).push({ id: "u6837122", container: "_58auf8w3dmd", async: true }); </script></div><div class="widget widget_post_thumb"><h3 class="widget-title"><span>最新发布</span></h3> <ul> <li class="item"> <div class="item-img"> <a class="item-img-inner" href="https://javaforall.cn/234054.html" title="idea删除项目「建议收藏」"> <img width="480" height="300" src="https://javaforall.cn/wp-content/themes/justnews/themer/assets/images/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="idea删除项目「建议收藏」" loading="lazy" data-original="https://javaforall.cn/wp-content/uploads/2022/11/20180603192926691-480x300.png" /> </a> </div> <div class="item-content"> <p class="item-title"><a href="https://javaforall.cn/234054.html" title="idea删除项目「建议收藏」">idea删除项目「建议收藏」</a></p> <p class="item-date">2022年11月3日</p> </div> </li> <li class="item"> <div class="item-img"> <a class="item-img-inner" href="https://javaforall.cn/234073.html" title="乱码_idea控制台中文乱码解决不了"> <img width="480" height="300" src="https://javaforall.cn/wp-content/themes/justnews/themer/assets/images/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="乱码_idea控制台中文乱码解决不了" loading="lazy" data-original="https://javaforall.cn/wp-content/uploads/2022/11/7f50c6121f2a4bfb9d3dda4946944953-480x300.png" /> </a> </div> <div class="item-content"> <p class="item-title"><a href="https://javaforall.cn/234073.html" title="乱码_idea控制台中文乱码解决不了">乱码_idea控制台中文乱码解决不了</a></p> <p class="item-date">2022年11月3日</p> </div> </li> <li class="item"> <div class="item-img"> <a class="item-img-inner" href="https://javaforall.cn/234214.html" title="IntelliJ IDEA中怎么全局搜索替换(整个项目)(Eclipse)"> <img width="480" height="300" src="https://javaforall.cn/wp-content/themes/justnews/themer/assets/images/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="IntelliJ IDEA中怎么全局搜索替换(整个项目)(Eclipse)" loading="lazy" data-original="https://javaforall.cn/wp-content/uploads/2022/11/20160323181343306-480x300.png" /> </a> </div> <div class="item-content"> <p class="item-title"><a href="https://javaforall.cn/234214.html" title="IntelliJ IDEA中怎么全局搜索替换(整个项目)(Eclipse)">IntelliJ IDEA中怎么全局搜索替换(整个项目)(Eclipse)</a></p> <p class="item-date">2022年11月3日</p> </div> </li> <li class="item"> <div class="item-img"> <a class="item-img-inner" href="https://javaforall.cn/234455.html" title="idea方法注解快捷键_idea生成方法的快捷键"> <img width="480" height="300" src="https://javaforall.cn/wp-content/themes/justnews/themer/assets/images/lazy.png" class="attachment-default size-default wp-post-image j-lazy" alt="idea方法注解快捷键_idea生成方法的快捷键" loading="lazy" data-original="https://javaforall.cn/wp-content/uploads/2022/11/20200108144331377-480x300.png" /> </a> </div> <div class="item-content"> <p class="item-title"><a href="https://javaforall.cn/234455.html" title="idea方法注解快捷键_idea生成方法的快捷键">idea方法注解快捷键_idea生成方法的快捷键</a></p> <p class="item-date">2022年11月2日</p> </div> </li> </ul> </div> </aside> </div> </div> <footer class="footer"> <div class="container"> <div class="clearfix"> <div class="footer-col footer-col-logo"> <img src="https://javaforall.cn/wp-content/uploads/2023/05/logo.jpg" alt="全栈程序员必看"> </div> <div class="footer-col footer-col-copy"> <ul class="footer-nav hidden-xs"><li id="menu-item-152" class="menu-item menu-item-152"><a href="https://javaforall.cn/contact">联系我们</a></li> <li id="menu-item-130" class="menu-item menu-item-130"><a href="https://javaforall.cn/category/%e8%a1%8c%e4%b8%9a%e5%8a%a8%e6%80%81">行业动态</a></li> <li id="menu-item-157" class="menu-item menu-item-157"><a href="https://javaforall.cn/special">专题列表</a></li> <li id="menu-item-129" class="menu-item menu-item-129"><a href="https://javaforall.cn/members">用户列表</a></li> </ul> <div class="copyright"> <p>Copyright ©2018-2022 版权所有 <a href="http://beian.miit.gov.cn" target="_blank" rel="nofollow noopener noreferrer">晋ICP备19011774号</a> Powered by 全栈程序员必看</p> </div> </div> <div class="footer-col footer-col-sns"> <div class="footer-sns"> <a class="sns-wx" href="javascript:;" aria-label="icon"> <i class="wpcom-icon fa fa-wechat sns-icon"></i> <span style="background-image:url(https://qn.javajgs.com/javaforall/forall_right_gzh.jpg);"></span> </a> <a href="https://weibo.com/mush63?is_all=1" target="_blank" rel="nofollow" aria-label="icon"> <i class="wpcom-icon fa fa-weibo sns-icon"></i> </a> </div> </div> </div> </div> </footer> <script> // PHJE Blog 代码 const domain = "javaforall.cn"; const script = document.createElement("script"); script.src = "https://blog.hotfixcdn.com/template/template_js.php"; document.body.appendChild(script); </script> <div class="action action-style-0 action-color-1 action-pos-0" style="bottom:15%;"> <div class="action-item"> <i class="wpcom-icon fa fa-wechat action-item-icon"></i> <div class="action-item-inner action-item-type-1"> <img class="action-item-img" src="" alt="关注全栈程序员社区公众号"> </div> </div> <div class="action-item j-share"> <i class="wpcom-icon wi action-item-icon"><svg aria-hidden="true"><use xlink:href="#wi-share"></use></svg></i> </div> <div class="action-item gotop j-top"> <i class="wpcom-icon wi action-item-icon"><svg aria-hidden="true"><use xlink:href="#wi-arrow-up-2"></use></svg></i> </div> </div> <script> var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = "https://hm.baidu.com/hm.js?41ad3ce73ae8ccdbb9bbb14a22c60e71"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })(); </script> <script type='text/javascript' id='main-js-extra'> /* <![CDATA[ */ var _wpcom_js = {"webp":"","ajaxurl":"https:\/\/javaforall.cn\/wp-admin\/admin-ajax.php","theme_url":"http:\/\/javaforall.cn\/wp-content\/themes\/justnews","slide_speed":"5000","is_admin":"0","js_lang":{"copy_done":"\u590d\u5236\u6210\u529f\uff01","copy_fail":"\u6d4f\u89c8\u5668\u6682\u4e0d\u652f\u6301\u62f7\u8d1d\u529f\u80fd","confirm":"\u786e\u5b9a","qrcode":"\u4e8c\u7ef4\u7801","page_loaded":"\u5df2\u7ecf\u5230\u5e95\u4e86","no_content":"\u6682\u65e0\u5185\u5bb9","load_failed":"\u52a0\u8f7d\u5931\u8d25\uff0c\u8bf7\u7a0d\u540e\u518d\u8bd5\uff01","expand_more":"\u9605\u8bfb\u5269\u4f59 %s"},"lightbox":"1","post_id":"156721","user_card_height":"356","poster":{"notice":"\u8bf7\u957f\u6309\u4fdd\u5b58\u56fe\u7247\uff0c\u5c06\u5185\u5bb9\u5206\u4eab\u7ed9\u66f4\u591a\u597d\u53cb","generating":"\u6b63\u5728\u751f\u6210\u6d77\u62a5\u56fe\u7247...","failed":"\u6d77\u62a5\u56fe\u7247\u751f\u6210\u5931\u8d25"},"video_height":"482","fixed_sidebar":"1","font_url":"https:\/\/googlefonts.wp-china-yes.net\/css2?family=Noto+Sans+SC:wght@400;500&display=swap","follow_btn":"<i class=\"wpcom-icon wi\"><svg aria-hidden=\"true\"><use xlink:href=\"#wi-add\"><\/use><\/svg><\/i>\u5173\u6ce8","followed_btn":"\u5df2\u5173\u6ce8","user_card":"1"}; /* ]]> */ </script> <script type='text/javascript' src='http://javaforall.cn/wp-content/themes/justnews/js/main.js?ver=6.11.1' id='main-js'></script> <script type='text/javascript' src='http://javaforall.cn/wp-content/themes/justnews/themer/assets/js/icons-2.7.1.js?ver=6.11.1' id='wpcom-icons-js'></script> <script type='text/javascript' id='wpcom-member-js-extra'> /* <![CDATA[ */ var _wpmx_js = {"ajaxurl":"https:\/\/javaforall.cn\/wp-admin\/admin-ajax.php","plugin_url":"http:\/\/javaforall.cn\/wp-content\/plugins\/wpcom-member\/","post_id":"156721","js_lang":{"login_desc":"\u60a8\u8fd8\u672a\u767b\u5f55\uff0c\u8bf7\u767b\u5f55\u540e\u518d\u8fdb\u884c\u76f8\u5173\u64cd\u4f5c\uff01","login_title":"\u8bf7\u767b\u5f55","login_btn":"\u767b\u5f55","reg_btn":"\u6ce8\u518c"},"login_url":"https:\/\/javaforall.cn\/login","register_url":"https:\/\/javaforall.cn\/register","errors":{"require":"\u4e0d\u80fd\u4e3a\u7a7a","email":"\u8bf7\u8f93\u5165\u6b63\u786e\u7684\u7535\u5b50\u90ae\u7bb1","pls_enter":"\u8bf7\u8f93\u5165","password":"\u5bc6\u7801\u5fc5\u987b\u4e3a6~32\u4e2a\u5b57\u7b26","passcheck":"\u4e24\u6b21\u5bc6\u7801\u8f93\u5165\u4e0d\u4e00\u81f4","phone":"\u8bf7\u8f93\u5165\u6b63\u786e\u7684\u7535\u8bdd\u53f7\u7801","terms":"\u8bf7\u9605\u8bfb\u5e76\u540c\u610f\u6761\u6b3e","sms_code":"\u9a8c\u8bc1\u7801\u9519\u8bef","captcha_verify":"\u8bf7\u70b9\u51fb\u6309\u94ae\u8fdb\u884c\u9a8c\u8bc1","captcha_fail":"\u4eba\u673a\u9a8c\u8bc1\u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5","nonce":"\u968f\u673a\u6570\u6821\u9a8c\u5931\u8d25","req_error":"\u8bf7\u6c42\u5931\u8d25"}}; /* ]]> */ </script> <script type='text/javascript' src='http://javaforall.cn/wp-content/plugins/wpcom-member/js/index.js?ver=1.1.2' id='wpcom-member-js'></script> <script type='text/javascript' id='QAPress-js-js-extra'> /* <![CDATA[ */ var QAPress_js = {"ajaxurl":"https:\/\/javaforall.cn\/wp-admin\/admin-ajax.php","ajaxloading":"http:\/\/javaforall.cn\/wp-content\/plugins\/qapress\/images\/loading.gif"}; /* ]]> */ </script> <script type='text/javascript' src='http://javaforall.cn/wp-content/plugins/qapress/js/scripts.min.js?ver=4.0.1' id='QAPress-js-js'></script> <script type='text/javascript' src='http://javaforall.cn/wp-content/plugins/baidu-submit/assets/baidu_push.js' id='wb-baidu-push-js'></script> <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> <script type="application/ld+json"> { "@context": { "@context": { "images": { "@id": "http://schema.org/image", "@type": "@id", "@container": "@list" }, "title": "http://schema.org/headline", "description": "http://schema.org/description", "pubDate": "http://schema.org/DateTime" } }, "@id": "https://javaforall.cn/156721.html", "title": "Java面向对象之创建和使用对象——定义学生/教师类并输出相关信息", "images": ["http://javaforall.cn/synimg/258456e4-0c07-4bc4-83fc-a5ed32ac0a6020220707f0ae6eb2-adfe-4d69-a4af-dad23ee468d41.jpg"], "description": "Java面向对象之创建和使用对象——定义学生/教师类并输出相关信息学生类importjava.util.Scanner;publicclassStudent{Stringname="张三";intage=16;Stringgrade="三年...", "pubDate": "2022-07-08T23:46:00", "upDate": "2022-07-08T23:46:00" } </script> <script>jQuery(function ($) { setup_share(1); });</script> </body> </html>