Giter Site home page Giter Site logo

javalabs's Introduction

JAVALABS

import java.util.*

import java.lang.* is for implements runnable or extends thread

import java.util.Scanner is for scanner or input

The static keyword in Java is used to share the same variable or method of a given class. The users can apply static keywords with variables, methods, blocks, and nested classes. The static keyword belongs to the class than an instance of the class. (used for overloading)

a method is a function within a class method overloading is same as function overloading and no object needs to be created to call it

for constructor overloading name of class is same as constructors(constructs are like methods but difference is they share name of the class they are in). object needs to be created for calling.

for string taking input: String s = sc.next(); functons: s.length() s.charAt(4) s.toUpperCase()

ArrayIndexoutOfBoundsException ArithmeticException ClassNotFoundException

List of Programs

  • Floyds, Armstrong And Pattern
  • Control structure (fibo, fact)
  • Method overloading amd constructor overloading
  • Arrays (matrix)
  • Vectors and strings
  • Inheritance
  • Interfaces
  • Packages
  • Exception handling (/0 and Index)
  • Multithreading
  • I/O stream
  • Calc using AWT
  • Student form using swing
  • GUI
  • Login using JavaFX

Things to Remember

Import Libraries

import java.util.*;
// for input
import java.util.Scanner;
// for implements runnable or extends thread
import java.lang.*

Main Class Structure

public class Main {
    public static void main(String args[]) {
       // code
    }
}

Scanner

Scanner sc = new Scanner (System.in);
int n=sc.nextInt(); // store input to integer n
String s = sc.next(); //  store input to string s
sc.close(); // close to prevent memory leaking

Executing

javac Main.java
java Main

Vectors

Creating

// Create Vector with Capacity 10
Vector name = new Vector();
// Create Vector with Capacity 15 and default steps
Vector name2 = new Vector(15);
// Create Vector with Capacity 20 and step size of 5
Vector name3 = new Vector(20,5);

Add

// add int
v_new.add(25);
// add string
v_new.add("Java");
// add using index
v_new.add(1, "Java");

Remove

// remove index
v_new.remove(0);
// remove element
v_new.remove("Java");

Functions

// prints the current 
v_new.size();
// prints the capacity
v_new.capacity();
// trim to size
v_new.trimToSize();

javalabs's People

Contributors

ayeshanagdawala avatar anxkhn avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.