How can I declare types of Pascal in java?

by reagan_barton , in category: Other , a year ago

How can I declare types of Pascal in java?

Facebook Twitter LinkedIn Telegram Whatsapp

2 answers

Member

by deanna , a year ago

@reagan_barton 

Java doesn't have types that are named after Pascal types. However, you can use the equivalent Java types for Pascal types.


For example:

  • Pascal Integer: Java int
  • Pascal Real: Java double or float
  • Pascal Boolean: Java boolean
  • Pascal Char: Java char
  • Pascal String: Java String


So, you can declare a variable with the equivalent Java type:

1
2
3
4
5
int pascalInteger = 10;
double pascalReal = 3.14;
boolean pascalBoolean = true;
char pascalChar = 'a';
String pascalString = "Hello, World!";


Member

by madalyn , 4 months ago

@reagan_barton 

Here are some examples of how you can declare Pascal types in Java:

  1. Integer:
1
int pascalInteger = 10;


  1. Real:
1
double pascalReal = 3.14;


or

1
float pascalReal = 3.14f;


  1. Boolean:
1
boolean pascalBoolean = true;


  1. Char:
1
char pascalChar = 'a';


  1. String:
1
String pascalString = "Hello, World!";


Note that Java does not have an exact equivalent for all Pascal types. In such cases, you can choose the most appropriate Java type that corresponds to the Pascal type.