I'm not sure I understand your question.
"Strong/weak typed" is a quality of programming languages. Java is strongly typed, which means it has a strict syntax, and it can find problems in your code at compile time, before errors make it to run time.
Java may not exactly be type safe, though (I'm not sure of the exact answer). It allows generics, which means you can make an ArrayList of Strings (ArrayList<String>
), ArrayList of Integers (ArrayList<Integer>
), ArrayList of Booleans (ArrayList<Boolean>
). ArrayList<T>
means you can substitute <T>
with any object. ArrayList<? extends T>
means you can substitute with any A, B, C, Potato, etc. that extends T.
Say you have the following classes:
class Admin extends User {
//Stuff
}
class Student extends User {
//Stuff
}
class Teacher extends User {
//Stuff
}
You can even have an ArrayList of any child of a User object, for example: ArrayList<User>
.
To this list, you can add Student, Admin, and Teacher objects.
But if you do not specify what type of data this ArrayList holds (eg: List l = new ArrayList();
), you can place any Object in it, causing it to not be type safe.
An example of generics abuse can be seen on Wikipedia.