Java类class isSynthetic()方法及示例

类的类isSynthetic()方法 (Class class isSynthetic() method)

  • isSynthetic() method is available in java.lang package.

    isSynthetic()方法在java.lang包中可用。

  • isSynthetic() method is used to check whether this Class is a synthetic class or not.

    isSynthetic()方法用于检查此Class是否为合成类。

  • isSynthetic() method is a non-static method, it is accessible with the class object only and if we try to access the method with the class name then we will get an error.

    isSynthetic()方法是一个非静态方法,只能通过类对象访问,如果尝试使用类名称访问该方法,则会收到错误消息。

  • isSynthetic() method does not throw an exception at the time of checking synthetic class.

    在检查综合类时, isSynthetic()方法不会引发异常。

Syntax:

句法:

    public boolean isSynthetic();

Parameter(s):

参数:

  • It does not accept any parameter.

    它不接受任何参数。

Return value:

返回值:

The return type of this method is boolean, it returns a boolean value based on the following cases,

此方法的返回类型为boolean ,它基于以下情况返回布尔值:

  • It returns true, when this Class is a synthetic class.

    当此Class是综合类时,它返回true

  • It returns false, when this Class is not a synthetic class.

    如果此Class不是合成类,则返回false

Example:

例:

// Java program to demonstrate the example 
// of boolean isSynthetic() method of Class
public class IsSyntheticOfClass {
public static void main(String[] args) {
// Create and Return String class
String str = new String();
Class cl1 = str.getClass();
// We are checking the class is a
// Synthetic class
boolean b1 = cl1.isPrimitive();
System.out.print("Is" + " " + cl1.getSimpleName() + " ");
System.out.println("Synthetic class" + ": " + b1);
}
}

Output

输出量

Is String Synthetic class: false

翻译自: https://www.includehelp.com/java/class-class-issynthetic-method-with-example.aspx

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/379238.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

BNU OJ 第26303 题 Touchscreen Keyboard

BNU OJ第26303题Touchscreen Keyboard(题目链接)的解题报告。 原题如下: Touchscreen Keyboard Problem Description Nowadays, people do not use hardware keyboards but touchscreens. Usually, they touch on the wrong letters with the…

列表(二)

1,什么是列表? 列表由一系列按特定顺序排列的元素组成。得知列表内的元素是有序的。 在Python中,用方括号([])来表示列表,并用逗号来分隔其中的元素。 color [red,blue,black,yellow]#定义一个字符串列表…

Zigbee在.Net Micro Framework系统中的应用

Zigbee是IEEE 802.15.4协议的代名词。根据这个协议规定的技术是一种短距离、低功耗的无线通信技术。这一名称来源于蜜蜂的八字舞,由于蜜蜂(bee)是靠飞翔和“嗡嗡”(zig)地抖动翅膀的“舞蹈”来与同伴传递花粉所在方位信息,也就是说蜜蜂依靠这样的方式构成…

ffmpeg-AVFrame分配内存问题

目录:1、格式:交错式2、格式:平坦式3、总结:1、格式:交错式 LRLRRLRLRLRLRLRLRLR 2、格式:平坦式 LLLLLLRRRRRR 3、总结: 两种方式的内存排列在AVFrame中分配是有区别的 交错式在一个buf…

stl中map函数_map :: empty()函数以及C ++ STL中的Example

stl中map函数C STL映射:: empty() (C STL map::empty()) It is built-in function in C STL and used to check whether the map container is empty or not i.e whether its size is 0 or not? 它是C STL中的内置函数,用于检查地图容器是否为空,即其…

C#使用Dotfuscator混淆代码以及加密

C#编写的代码如果不进行一定程度的混淆和加密,那么是非常容易被反编译进行破解的,特别是对于一些商业用途的C#软件来说,因为盯着的人多,更是极易被攻破。使用Dotfuscator可以实现混淆代码、变量名修改、字符串加密等功能。 这里介…

操作列表(三)

1,for循环(for 变量名 in 列表名:) phone [iphone 8, xiaomi10pro, huaweiv30pro, honor20, jianguopro]#定义一个列表phone for tel in phone:print("手机的类型为:" tel.title())#当然这里的每个元素也可以调用title()等一些方法 print(&…

C#特性之通俗演义

首先要说的是,可能一些刚接触C#的朋友常常容易把属性(Property)跟特性(Attribute)弄混淆,其实这是两种不同的东西。属性就是面向对象思想里所说的封装在类里面的数据字段,其形式为: …

栈应用_计算按运算符优先级分布的算式(代码、分析、汇编)

目录&#xff1a;代码&#xff1a;分析&#xff1a;汇编&#xff1a;代码&#xff1a; LinkList.h LinkList.c LinkStack.h LinkStack.c 栈-线性表 main.c #include <stdio.h> #include "LinkStack.h"//该程序用栈来计算算式 /*比如&#xff1a;1*56/(5-3)…

php globals_PHP $ GLOBALS(超级全局变量),带有示例

php globalsPHP $全球 (PHP $GLOBALS) PHP $GLOBALS is the only superglobal that does not begin with an underscore (_). It is an array that stores all the global scope variables. PHP $ GLOBALS是唯一不以下划线( _ )开头的超全局变量。 它是一个存储所有全局范围变量…

安装部署项目(转自)

1 新建安装部署项目 打开VS&#xff0c;点击新建项目&#xff0c;选择&#xff1a;其他项目类型->安装与部署->安装向导(安装项目也一样)&#xff0c;然后点击确定。 2 安装向导 关闭后打开安装向导&#xff0c;点击下一步&#xff0c;或者直接点击完成。 3 开始制作…

java.lang.ClassNotFoundException: sun.jdbc.odbc.JdbcOdbcDriver

更改jdk&#xff0c;版本过高的缘故&#xff0c;更改jdk为1.7版本

kotlin 查找id_Kotlin程序查找给定范围内的素数

kotlin 查找idA prime number is a natural number that is greater than 1 and cannot be formed by multiplying two smaller natural numbers. 质数是大于1的自然数&#xff0c;不能通过将两个较小的自然数相乘而形成。 Given a range start and end, we have to print al…

socket代码

客户端:#include <stdio.h> #include <stdlib.h> #include <string.h> #include <netdb.h> #include <sys/types.h> #include <sys/socket.h> int main(int argc,char *argv[]) {int sockfd,numbytes;char buf[100];struct sockaddr_in th…

栈应用_将算式转成按运算符优先级分布(代码、分析、汇编)

目录&#xff1a;代码&#xff1a;分析&#xff1a;汇编&#xff1a;代码&#xff1a; LinkList.h LinkList.c LinkStack.h LinkStack.c 栈-线性表 main.c #include <stdio.h> #include "LinkStack.h"/* 该程序将 正常的算式 转换成按照运算符优先分布的算式…

课堂笔记(一)

1&#xff0c;怎样查询函数的用法 help(函数名) 2&#xff0c;表达式float(0b1100010101)float(0o1425)float(0x315)的结果是什么&#xff0c;并说明原因 True 浮点类型的数用二进制八进制十六进制的不同表达 3&#xff0c;oct()方法 转换八进制输出 4&#xff0c;hex()方…

Struts2.0标签使用之s:checkboxlist/

jsp代码如下&#xff1a; <s:form action"receive.action" method"post"> <s:checkboxlist id"user" name"cheuser" list"#request.userlist" listKey"id" listValue"name" lab…

[转]深入浅出Java设计模式之备忘录模式

本文转自&#xff1a;http://dev.yesky.com/450/2070450.shtml 一、引子   俗话说&#xff1a;世上难买后悔药。所以凡事讲究个“三思而后行”&#xff0c;但总常见有人做“痛心疾首”状&#xff1a;当初我要是……。如果真的有《大话西游》中能时光倒流的“月光宝盒”&#…

递归问题(代码、分析、汇编)

目录&#xff1a;代码&#xff1a;分析&#xff1a;汇编&#xff1a;代码&#xff1a; main.c #include <stdio.h>//该程序使用递归将字符串从后往前依次输出void reverse(char* s) {if( (s ! NULL) && (*s ! \0) ){reverse(s 1);printf("%c", *s);…

Java LocalDate类| ofYearDay()方法与示例

LocalDate类的YearDay()方法 (LocalDate Class ofYearDay() method) ofYearDay() method is available in java.time package. ofYearDay()方法在java.time包中可用。 ofYearDay() method is used to create an instance of LocalDate object that holds the value from the ye…