I am new to AWS and want to know if there is any way to how to reboot and change termination protection of an EC2 instance programmatically(using JAVA)
To reboot an EC2 Instance, you have to call the method rebootInstances of your AWS EC2 Java client.
To enable/disable termination protection, you have to modify the setDisableApiTermination of a ModifyInstanceAttributesRequest using the method as argument of the method modifyInstanceAttribute of your AWS EC2 Java client.