1/** 2 * Copyright (c) 2024-2025 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15class Test { 16 public constructor() {} 17 public constructor(a: int, b: int, c: int, d: int, e: int, f: int = 0) { 18 console.log(a, b, c, d, e, f) 19 } 20 test() { 21 console.log("test") 22 } 23 24 test2() { 25 } 26 27 test2(a: int) { 28 console.log("test2") 29 if(a > 0) { 30 return 1 31 } 32 return -1; 33 } 34 35 test3(a: int) { 36 try { 37 a = a + 1 38 } catch(e){ 39 a = a - 1 40 return a 41 } 42 return a 43 } 44} 45 46function test0() { 47} 48 49function test0(a: int) { 50 console.log("test0 ", a) 51} 52 53function test1(b: String) { 54} 55 56function main() { 57 const test = new Test() 58 test.test() 59 test.test2(1) 60 test0() 61 test1("hgf") 62 test.test2() 63 const test2 = new Test(1, 2, 3, 4, 5) 64} 65