Java, Python & JavaScript

anders, different, opposition-1022316.jpg

Code Syntax

FunctionJAVAPYTHONJAVASCRIPT
Data Typesint number = 10;
String name = “Jones”;
float perc = 85.5f
num = 10
name = ‘Jones’
percentage = 85.5
var num = 10;
const name = ‘Jones’;
let percentage = 85.5;
Operatorsint sum = a + b;
int div = a / b;
int mul = a * b;
sum = a + b
div = a / b
mul = a * b
var sum = a + b;
var div = a / b;
var mul = a * b;
LoopsString[] sub = {“English”, “Maths”, “Science”};
for x in sub {
System.out.println(x);
}
if (b > a) {
System.out.println(“b is greater than a”);
}
subjects= [“English”, “Maths”, “Science”]
for x in subjects:
  print(x)
if b > a:
  print(“b is greater than a”)
const subjects = [“English”, “Maths”, “Science”];
for (let x of subjects) {
console.log(x);
}
if (b > a) {
console.log(“b is greater than a”);
}
CollectionsArrayList list = new ArrayList<>();
list.add(10);
HashSet<Integer> set = new HashSet<>(); HashMap<String, String> dictionary = new HashMap<>();
list = [10,20,30,40,50]
tupple = (10,20,30,40,50,60,50,40)
set = {12,43,232,30}
dictionary = {“Name”: “Jones”, “Address”: “Canada”}
const array = [10, 20, 30, 40, 50];
const set = new Set([12, 43, 232, 30])
const dictionary = new Map([[“Name”, “Jones”],[“Address”, “Canada”]]);
Classpublic class Person {
private String name;
private String address;
public Person(String name, String address) { this.name = name; this.address = address;
}
Person person = new Person(“Jones”, “Canada”);
class Person:
def init(self,name):
setattr(self,”NAME”,name)
setattr(self,”ADDRESS”,address)

person = Person(“Jones”,”Canada”)
class Person {
constructor(name, address) {
this.name = name;
this.address = address;
}
}
const person = new Person(“Jones”, “Canada”);
Inheritanceclass Developer {
private String name;
private int age;
public Developer(String name, int age) {
this.name = name;
this.age = age;
}}
class Employee extends Developer {}
class Developer:
def init(self, name, age):
self.__name = name
self.__age = age

class Employee(Developer):
pass

employee = Employee(“Jones”, 10)
class Developer {
constructor(name, age) {
this.name = name;
this.age = age;
}
}

class Employee extends Developer {}
const employee = new Employee(“Jones”, 10);
Packageimport java.util.List;from package1.course import *
import pandas as pd

import App from ‘./App’;

error: Content is protected !!
Scroll to Top