用java语言开发的软件并进行销售,算侵权吗?为什么?

Python014

用java语言开发的软件并进行销售,算侵权吗?为什么?,第1张

你是不是看到Java使用了GPL开源软件协议?对于普通的采用GPL协议的库或软件,你可以对软件进行任何形式的修改,复制和销售。但是有一个限制,就是一旦你发布软件,就必须向你的发布对象公布你的源代码,否则就是不遵守GPL开原协议(就是说,如果你的软件中使用的基于GPL的库,并且你把你的软件卖个A,则必须同时向A提供源代码)。这是普通的GPL协议的规定,而java虽然也使用GPL开源协议,开源了java系统类库的代码,但是他的协议同时提出了一个例外条件,就是只要你修改java本身提供的类代码,你可以不向软件发布人员公开你的源码。这就是为什么java可以免费使用,而且在通常情况下可以不公开源代码的原因。

不过国内的版权意识比较淡薄,很多软件使用了GPL开源库,也没有公开源码,按严格意义上讲这是违反版权的,自由软件基金会可以按协议向法院起诉开发人员.............

Java程序:

import java.io.IOException

import java.util.ArrayList

import java.util.List

import java.util.Scanner

/**

 * 汽车

 */

class Car {

/**

 * 汽车编号

 */

protected int id = 0

/**

 * 汽车款式

 */

protected String type = null

/**

 * 构造汽车对象

 */

public Car() {

}

/**

 * 构造汽车对象

 * @param id 汽车编号

 * @param type 汽车款式

 */

public Car(int id, String type) {

this.id = id

this.type = type

}

/**

 * 获得汽车编号

 * @return 汽车编号

 */

public int getId() {

return this.id

}

/**

 * 获得汽车款式

 * @return 汽车款式

 */

public String getType() {

return this.type

}

}

/**

 * 汽车销售人员类

 */

class Saler {

/**

 * 姓名

 */

protected String name = null

public List<Car> cars = new ArrayList<Car>()

/**

 * 构造销售汽车人员对象

 */

public Saler() {

}

/**

 * 构造汽车销售人员对象

 * @param name 姓名

 */

public Saler(String name) {

this.name = name

}

/**

 * 获得姓名

 * @return 姓名

 */

public String getName() {

return this.name

}

}

public class Main {

public static void main(String[] args) {

Scanner scan = new Scanner(System.in)

List<Car> allCar = new ArrayList<Car>() //待售汽车对象的集合

allCar.add(new Car(1001, "凯越"))

allCar.add(new Car(1002, "凯越"))

allCar.add(new Car(1003, "凯越"))

allCar.add(new Car(1004, "凯越"))

allCar.add(new Car(2001, "君威"))

allCar.add(new Car(2002, "君威"))

allCar.add(new Car(2003, "君威"))

allCar.add(new Car(2004, "君威"))

allCar.add(new Car(2005, "君威"))

Saler saler = new Saler("张三其")

int choice = 0

int type //销售车型

int num //销售数量

while(true) {

System.out.println("请选择销售方式")

System.out.println("按车辆销售:\t1")

System.out.println("按车型销售:\t2")

System.out.println("查看销售情况:\t3")

System.out.println("退出:\t\t0")

System.out.print("您的选择:")

choice = scan.nextInt()

switch(choice) {

case 0: //退出系统

System.out.println("退出系统")

System.exit(0)

break

case 1: //按车辆销售

for(Car car : allCar) {

if(! exists(saler.cars, car)) {

saler.cars.add(car)

System.out.printf("\t售出 %s 1 辆\n", car.getType())

break

}

}

break

case 2: //按车型销售

System.out.print("车型(凯越  0/君威  1):")

type = scan.nextInt()

System.out.print("销售数量:")

num = scan.nextInt()

int c = 0 //实际销售数量

for(Car car : allCar) {

if(c >= num) {

break

}

if(car.getType().equals(type == 0 ? "凯越" : "君威") && ! exists(saler.cars, car)) {

saler.cars.add(car)

c++

}

}

if(c < num) {

System.out.printf("\t库存不足,实际售出 %s %d 辆\n", type == 0 ? "凯越" : "君威", c)

}

else {

System.out.printf("\t售出 %s %d 辆\n", type == 0 ? "凯越" : "君威", num)

}

break

case 3: //查看销售情况

System.out.println("\t当前销售情况一览")

System.out.printf("\t%10s%10s\n", "汽车款式", "汽车编号")

for(Car car : saler.cars) {

System.out.printf("\t%10s%10d\n", car.getType(), car.getId())

}

System.out.println("---------------------------")

System.out.printf("\t小计:\t%d 辆\n", saler.cars.size())

break

default:

break

}

try {

System.in.read()

} catch (IOException e) {

// TODO Auto-generated catch block

e.printStackTrace()

}

}

}

//判断car在cars中是否存在

public static boolean exists(List<Car> cars, Car car) {

for(Car c : cars) {

if(c.getId() == car.getId()) {

return true

}

}

return false

}

}

运行测试:

请选择销售方式

按车辆销售: 1

按车型销售: 2

查看销售情况: 3

退出: 0

您的选择:1

售出 凯越 1 辆

请选择销售方式

按车辆销售: 1

按车型销售: 2

查看销售情况: 3

退出: 0

您的选择:2

车型(凯越  0/君威  1):0

销售数量:3

售出 凯越 3 辆

请选择销售方式

按车辆销售: 1

按车型销售: 2

查看销售情况: 3

退出: 0

您的选择:3

当前销售情况一览

      汽车款式      汽车编号

        凯越      1001

        凯越      1002

        凯越      1003

        凯越      1004

---------------------------

小计: 4 辆

请选择销售方式

按车辆销售: 1

按车型销售: 2

查看销售情况: 3

退出: 0

您的选择:0

退出系统