Java中的继承和线程 [英] inheritance and thread in java

查看:169
本文介绍了Java中的继承和线程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

继承和线程之间的主要区别是什么

what is the main difference between inheritance and thread

推荐答案

我猜主要区别在于,一个是继承,一个是线程.

继承是一种设计概念(来自Wiki)
在经典继承中,对象由类定义,类可以继承其他类.被称为子类(或派生类)的新类继承了先前存在的类的属性和行为,这些类和属性被称为超类(或祖先类)"

代码执行期间发生线程(来自Wiki)
执行线程是操作系统可以调度的最小处理单元,通常是计算机程序将其分叉到两个或多个同时运行的任务中

基本上,他们之间丝毫没有关系!
I guess the main difference is that one is inheritance and one is a thread.

Inheritance is a design concept (from Wiki)
"In classical inheritance where objects are defined by classes, classes can inherit other classes. The new classes, known as subclasses (or derived classes), inherit attributes and behavior of the pre-existing classes, which are referred to as superclasses (or ancestor classes)"

A thread happens during code execution (from Wiki)
a thread of execution is the smallest unit of processing that can be scheduled by an operating system, it generally results from a fork of a computer program into two or more concurrently running tasks

Basically, they have nothing to do with each other in the slightest!


这篇关于Java中的继承和线程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆